Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, wallacel.

Asked: October 10, 2000 - 5:58 pm UTC

Last updated: February 01, 2007 - 1:21 pm UTC

Version: 8.1.6

Viewed 1000+ times

You Asked

Tom:

I recently read your archived article and learned a lot.
however i have some question regarding "set size of rollback
segments'

<Quote>
To find out the size and number of rollback segments needed
to handle normal processing on the database you need to do
some testing. A good test is to start with small rollback
segments and allow your application to force them to extend.
Here are the steps to run such a test:

o Create a rollback segment tablespace.

o Select a number of rollback segments to test and create
them in the tablespace.

o Create the rollback segments so that all extents are the
same size. Choose an extent size that you suspect will
need between 10 to 30 extents when the segments grow to
full size.

o Each rollback segments should start with two extents
before the test is run. This is the minimum number of
extents any rollback segment can have.

o Only the rollback segments that you are testing and the
SYSTEM rollback segment should be online.
Run transactions and load typical of the application.

o Watch for rollback segment contention.

o Watch for the maximum size a rollback extends to.

The maximum size any one of the rollback segments reaches
during the test is the size you want to use when
configuring. This size we will call the "minimum coverage
size". If you see contention, adjust the number of segments
and rerun the test. Also, if the largest size requires
fewer than 10 extents, or more than 30, it is a good idea to
lower or raise the extent size, respectively, and rerun the
test. Otherwise, space may be getting wasted during the
test and this would throw the number off.

At the end of this test, you will have some good base
estimates for the size and number of rollback segments
needed for normal processing. However, handling large
transactions has not been discussed yet. Calculating the
segment size needed for these types of transactions as well
as how to meet the requests for the calculated space will be
addressed.

For sizing rollback segment extents, it is strongly
recommended that each extent be of the same size. The minimum
and maximum number of extents for an individual segment should
be around twenty for best performance.
</quote>



My question is during the testing , do i need to limit
user transaction? since we only use system rollback segments
and testing rollback segments , and if we have a lot of
user transactions, i guess testing rollback will continue
grow without limit.

( such as if we have 6 testing rollback segments and our setting
for transactions_per_rollback_segment is 5, then we should limit
user transactions to 30 or something like that.)
Regards,


and Tom said...

During the testing you want to run as many concurrent transactions as you will in real life -- what you are trying to find is how man/big should they be... running anything less then what you will run won't help you find that. if transactions/rollback segment isn't high enough to support your concurrent transactions during the test, increase it.

We won't use system rollback segments. they are for deferred rollback.


Rating

  (18 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Minimum Extents of Rollback Segments

Vivek Sharma, July 11, 2003 - 8:12 am UTC

Dear Tom,

Rollback segments should have minimum 2 extents. But what is the reason behind it ? Can u please explain why does rollback segment have min extents 2.

Your answer on this will be highly appreciated.

Thanks and Regards
Vivek Sharma



Tom Kyte
July 11, 2003 - 10:39 am UTC

predominantly because the documentation says so and they will not create otherwise :)

they are used as a circular queue, they (the extents) are treated like a linked list with the last entry in the list pointing to the first. Also, since we cannot enter and reuse the "front" of an extent until there are no active transactions IN the extent -- that would mean that every transaction that tried to span extents would fail (eg: you would suffer tons and tons of failed transactions)

That is, consider if the single extent were 1meg in size. I 100byte transaction starts with extent pointing at the very end. It puts 50 bytes in the extent, finds it to be full now -- and would then FAIL since it cannot reuse the head of the extent until there are no active transactions and by definition we know there is at least ONE active transaction -- ours.



Not Convinced...

Vivek Sharma, July 17, 2003 - 5:46 am UTC

Dear Tom,

I am very thankfull for your prompt replies. This site provides a very good input and is better media to gain knowledge.

I am not convinced by the answer provided by you to my above mentioned question. I do agree that the rollback segments will not be created unless 2 extents are provided but what is the logic behind this. Assuming that we could create it with 1 extent, when a trasaction needs another extend to span then it checks the head, there is one active transaction which is ours and hence it should then create another extent (no.2). This is what normally happens. If there are 2 extents, my transaction is extent 2 wants to span, it checks that there is no space and needs to span across another extent, it checks extent 1 (circular), there is an active transaction and hence it allocates the 3rd extent and so on...So why do we need 2 extents at minumum. What is oracle's logic behind it. Your answer will help me update my knowledge.

Thanks in advance

Regards
Vivek Sharma


Tom Kyte
July 17, 2003 - 10:41 am UTC

if you have one extent
and you set max extents to one

then you would jam the transaction at the end of the rbs each and every time.

hence ONE is not a good number at all for rollback segments

hence ONE is not a permitted number for rollback segments

TWO is the minimum.


if we let you use one, someone would set maxextents to one and get errors constantly, and say "stupid database". so we just don't let that happen.




1st Extent of RBS as Segment Header

Vivek Sharma, July 18, 2003 - 4:16 am UTC

Dear Tom,

I have read in one of the books that the first extent of the RBS is used by oracle as the segment header to manage the transaction information within the rollback segment.
The second extent contains the actual change vectors.

What are your comments on this ?

Regards
Vivek Sharma



Tom Kyte
July 18, 2003 - 8:43 am UTC

the head of the firt extent is, not the whole thing

rollback segment's data file corrupted

Reader, October 14, 2004 - 5:33 am UTC

Dear Tom,

We encounter one problem where one of our data file was corrupted and now in recover mode. The database is running on no archive log mode as it is not very critical. This corrupted data file is used by BIGROLLBACK tablespace and in this tablespace we have one rollback segment called BIG_ROLLSEG. We failed to drop or offline the rollback segment,tablespace or data file and the database can bring up for user to carry out their activity. We need your advice. Thanks.

Q1. Is there any way to drop the data file/segment/tablespace as the data file is still in recover mode? I believe there are some active transaction in the data file. Understand that there are undocumented parameter (_corrupted_rollback_segments=(rb1,rb2,...)
_offline_rollback_segment=(rb1,rb2,..)) in init.ora file. It is advisable to use this parameter to this drop the rollback segment ? If there any other solution you can think of.

Q2. Due to the incident, we have problem selecting xyz table using order by clause. It works if we take out the order by clause. Why this still happen even though we shutdown the DB and restart again ? If there any way to get rid of it if the data file corruption issue hasn't solved. Thanks

select * from xyz
order by 1;
ERROR:
ORA-00376: file 72 cannot be read at this time
ORA-01110: data file 72: '/d1/oradata/rbs.dbf'

Rgds
Reader

Tom Kyte
October 14, 2004 - 10:15 am UTC

just restore it like you would any file from your backup.

say you lost the file "really_the_most_important_data_to_our_company.dbf" -- what would you do then? do the same exact thing NOW. (because you in fact have lost that file, without RBS, well, most of the times that is just like losing SYSTEM)


So, just use your standard recovery process -- as if you lost a "normal" file (cause you have in fact lost a normal file -- RBS is not any different from a "normal" file)

use of that undocumented parameter would mean you MIGHT be able to open the database in order to SCRAPE OUT as much data as you can in order to REBUILD a new database elsewhere. contact support before using it.



RBS datafile usage

Yogesh, February 15, 2005 - 11:42 am UTC

My RBS tablespace has following files

NAME SIZE (BYTES / 800 MB each)
/oracle/orcl/rbs/rbs.dbf1,838860800
/oracle/orcl/rbs/rbs.dbf2,838860800
/oracle/orcl/rbs/rbs.dbf3,838860800
/oracle/orcl/rbs/rbs.dbf4,838860800
/oracle/orcl/rbs/rbs.dbf5,838860800
/oracle/orcl/rbs/rbs.dbf6,838860800

My init.ora parameter

rollback_segments = (RS1,RS2,RS3,RS7,RS10,RS11,RS12,RS24,RS29)

except RBS1, RBS2 all are public.

I want to know how these datafiles are allocated to RBS?

Following is the script used for creating these RBS.

CREATE ROLLBACK SEGMENT RBS1 TABLESPACE RBS
STORAGE (INITIAL 200M NEXT 10M MINEXTENTS 2 MAXEXTENTS 81);

CREATE ROLLBACK SEGMENT RBS2 TABLESPACE RBS
STORAGE (INITIAL 200M NEXT 10M MINEXTENTS 2 MAXEXTENTS 505);

CREATE PUBLIC ROLLBACK SEGMENT RBS3 TABLESPACE RBS
STORAGE (INITIAL 100M NEXT 100M MINEXTENTS 2 MAXEXTENTS 10);

CREATE PUBLIC ROLLBACK SEGMENT RBS7 TABLESPACE RBS
STORAGE (INITIAL 10M NEXT 10M MINEXTENTS 2 MAXEXTENTS 505);

CREATE PUBLIC ROLLBACK SEGMENT RBS10 TABLESPACE RBS
STORAGE (INITIAL 10M NEXT 10M MINEXTENTS 2 MAXEXTENTS 505);

CREATE PUBLIC ROLLBACK SEGMENT RBS11 TABLESPACE RBS
STORAGE (INITIAL 10M NEXT 10M MINEXTENTS 2 MAXEXTENTS 505);

CREATE PUBLIC ROLLBACK SEGMENT RBS12 TABLESPACE RBS
STORAGE (INITIAL 10M NEXT 10M MINEXTENTS 2 MAXEXTENTS 505);

CREATE PUBLIC ROLLBACK SEGMENT RBS24 TABLESPACE RBS
STORAGE (INITIAL 5M NEXT 1040K MINEXTENTS 2 MAXEXTENTS 505);

CREATE PUBLIC ROLLBACK SEGMENT RBS29 TABLESPACE RBS
STORAGE (INITIAL 5M NEXT 1040K MINEXTENTS 2 MAXEXTENTS 505);



Tom Kyte
February 15, 2005 - 3:37 pm UTC

look at dba_extents, but since they are all on the same mount point, so what.

RBS

Yogesh, February 16, 2005 - 7:10 am UTC

I think I did not frame my question properly. I want to know if oracle follows any algorithm while allocating space from datafile to specific RBS?

Tom Kyte
February 16, 2005 - 8:25 am UTC

we tend to go round robin, but nothing you could "rely" on.

(and you are 100% correct to say that this is an entirely different question from the previous one, 100% different)

size of RBS TBS

Yogesh, February 24, 2005 - 7:01 am UTC

If I'm planning to create following RBS, what should be the size of RBS TBS

CREATE ROLLBACK SEGMENT RBS1 TABLESPACE RBS
STORAGE (INITIAL 200M NEXT 10M MINEXTENTS 2 MAXEXTENTS 505);

200 M + (505 * 10)M ?

Secondly, I used following query

SELECT * FROM dba_rollback_segs WHERE status = 'ONLINE'

following are the results.

SEGMENT_NAME FILE_ID BLK_ID INITIAL_EX NEXT_EXTENT MAX_EXTENTS

SYSTEM 1 2 57344 57344 505
RBS3 5 2 209715200 10485760 505
RBS1 5 25602 209715200 10485760 81
RBS2 5 51202 104857600 104857600 10
RS24 5 66562 5242880 1064960 505
RS29 5 69762 5242880 1064960 505
RS7 5 73602 10485760 10485760 505
RS10 5 76162 10485760 10485760 505
RS11 5 77442 10485760 10485760 505
RS12 5 78722 10485760 10485760 505

I'm not able to understand, why all the file_id's are 5 (except system) ?

Size of file_id 5 is 800M. Does this mean all the RBS's are using only one file from RBS TBS?


Tom Kyte
February 24, 2005 - 8:18 am UTC

depends -- if this is an LMT, 200m + 10*2 + 64k with autoextend on next 10m might be nice.....


all of the file ids are 5 for the rbs's created in a tablespace with file 5

the other one is in system tablespace and that has a file id of 1 associated with it.



RBS TBS

Yogesh, February 24, 2005 - 8:57 am UTC

I'm using all DMT (Oracle 8.0.4). I don't want to use autoextend. I've size constraint of 6G.

Following are the current online rollback segments

CREATE ROLLBACK SEGMENT RBS1 TABLESPACE RBS
STORAGE (INITIAL 200M NEXT 10M MINEXTENTS 2 MAXEXTENTS 81);

CREATE ROLLBACK SEGMENT RBS2 TABLESPACE RBS
STORAGE (INITIAL 200M NEXT 10M MINEXTENTS 2 MAXEXTENTS 505);

CREATE PUBLIC ROLLBACK SEGMENT RBS3 TABLESPACE RBS
STORAGE (INITIAL 100M NEXT 100M MINEXTENTS 2 MAXEXTENTS 10);

CREATE PUBLIC ROLLBACK SEGMENT RBS7 TABLESPACE RBS
STORAGE (INITIAL 10M NEXT 10M MINEXTENTS 2 MAXEXTENTS 505);

CREATE PUBLIC ROLLBACK SEGMENT RBS10 TABLESPACE RBS
STORAGE (INITIAL 10M NEXT 10M MINEXTENTS 2 MAXEXTENTS 505);

CREATE PUBLIC ROLLBACK SEGMENT RBS11 TABLESPACE RBS
STORAGE (INITIAL 10M NEXT 10M MINEXTENTS 2 MAXEXTENTS 505);

CREATE PUBLIC ROLLBACK SEGMENT RBS12 TABLESPACE RBS
STORAGE (INITIAL 10M NEXT 10M MINEXTENTS 2 MAXEXTENTS 505);

CREATE PUBLIC ROLLBACK SEGMENT RBS24 TABLESPACE RBS
STORAGE (INITIAL 5M NEXT 1040K MINEXTENTS 2 MAXEXTENTS 505);

CREATE PUBLIC ROLLBACK SEGMENT RBS29 TABLESPACE RBS
STORAGE (INITIAL 5M NEXT 1040K MINEXTENTS 2 MAXEXTENTS 505);

I was getting "rollback segment too small error", when size was 4800MB. So I've added 2 more datafiles to this TBS, 800MB each. Now size of the TBS is 6000MB. I'm consistently monitoring the RBS usage after that. My findings are

These two newly added files are not used fully. Rather I can say, not used at all. Most of the times first file usage is 10Mb and second file usage is 2 MB.

I'm not sure about the sizes of existing rollback segments (Created by ex-dba). Can you please help me out in sizing these rollback segments?

Normally, this system is used for long running queries apart from daily data load.


Tom Kyte
February 24, 2005 - 9:17 am UTC

rbs too small -- you need to set minextents much larger... you need to have more permanently allocated space.

you need rbs to be sufficient large such that it does not roll around and reuse its storage during the period of time your longest running query is running.


if you are using 9i, use automatic undo management and set the undo_retention (and don't necessary be afraid of autoextend....)

Oracle 8.0.4

Yogesh, February 24, 2005 - 10:12 am UTC

Sorry to say Tom, but we are still running 8.0.4. So I can't use undo TBS. I'm not afraid of autoextend, because I know I don’t have physical space more than 6G, its of no use.

What are your recommendations now?


Tom Kyte
February 24, 2005 - 4:53 pm UTC

permanently size your total RBS larger or make your queries that run long run faster or...... suffer 1555's

there are no other choices.

reader

A reader, March 15, 2005 - 4:40 pm UTC

will you be able to clarify in brief the difference between rolback and undo segment in oracle 9ir2.....

Thanks and Regards
sachin

Tom Kyte
March 15, 2005 - 9:18 pm UTC

a rollback segment is an undo segment is a rollback segment.

they are synonymous

OK

Siva, June 06, 2005 - 2:12 pm UTC

Hi Tom,
Is there any manual way to flush the contents of rollback
segments?

Tom Kyte
June 06, 2005 - 3:04 pm UTC

flush them "where"??

OK

Siva, June 07, 2005 - 1:26 am UTC

I want to discard their contents and use them afresh.
Is that possible??

Tom Kyte
June 07, 2005 - 8:08 am UTC

why? what would you "gain" from this.

for, they are just a big circular buffer, used and reused. there is no meaning or concept to "flushing" them.

RBS and Data on same volume group / disk

Yogesh, January 17, 2006 - 9:51 am UTC

I have a situation where I've to increase the size of my RBS in one 8174 DB. Currently my existing RBS is created in /oracle/data/rbs filesystem.

This filesystem is mounted on rbsvg (rbs volume group in AIX). But this volume group is completely used. I can't allocate more space from this volume group to this FS. As well new disks can't be added.

I've some other volume groups where space is available, but those volume groups are already used for other oracle TBS files i.e. data filesystems.

I can create a new filesystem from these volumns, and create new RBS, but I am not sure if it will cause any I/O contension for existing data files.

Can you please give me your valuable adive?



Tom Kyte
January 17, 2006 - 10:18 am UTC

I cannot tell you if it would increase or decrease your IO contention.

It is not like RBS has to be separate from table data in the first place. That data is managed much like table data in the buffer cache, written out in the background by DBWR. It is really much like "table data".

goal is "even IO". I cannot say if you will cause an issue by adding some datafiles on these other volumes - the answer could be:

a) things will stay the same, this will not materially affect a thing

b) things will get much better because the current volume group you are hitting with rollback is overwhelmed and the data devices you are using are underutilized. This would make IO better.

c) things will get much worse because the data devices are overwhelmed currently and you'll be adding to their load.

No, this thread was not helpful

A reader, January 30, 2006 - 1:50 pm UTC

Tom,

Makes too many inaccurate statements.

Tom Kyte
January 30, 2006 - 3:41 pm UTC

such as? If you believe something is inaccurate do not hold back, educate. Point it out. If it is wrong, we'll correct. If you are wrong, we'll try to correct that to.

But I'm willing to learn - so point out something?

Just a stupid Reconfirmation !!

A reader, December 05, 2006 - 7:03 am UTC

We are service providers to a very large Oracle based Database system. I just discovered that the Oracle Database that is used to serve the system has only 1 Rollback segment and that too the System Rollback Segment.

Now the system is facing a lot of performance issues - we are going in the details of these issues but could the existence of only 1 rollback segment be a cause of the waits that the system is facing.

Tom Kyte
December 05, 2006 - 10:08 pm UTC

well, it would depend on....

what the system was waiting on


wouldn't it?

waiting for "log file sync" - doubtful it has to do with rollback for example

Only system rbs?

A reader, December 06, 2006 - 2:08 am UTC

I wonder if current versions of Oracle still give an ORA-1552 error if there are no rollback segments other than SYSTEM. If so, that might imply the whole database only has the one SYSTEM tablespace as well :-).

So how are rollback segments actually used?

C Smith, February 01, 2007 - 10:44 am UTC

I can't find any information as to how Oracle uses rollback segments if there are more than 1.

1) Lets say we have 10 rollback segments. If we have one transaction that fills up 1 rollback segment, will it then move on to the next rollback segment...or will it always force the first segment to extend?

2) If we have 2 separate transactions, will they use different rollback segments...if so, what happens when the number of transactions is greater than the number of rollback segments, are they then shared?

3) What exactly would be the point, then, of having more than one rollback segment, instead of having one almighty big one?

Hope you can help!

Many thanks!
Tom Kyte
February 01, 2007 - 1:21 pm UTC

1) no, a transaction is in a single segment always.

2) maybe. in general a rollback segment will have zero, one or more active transactions in it.

3) concurrency. less cooks in the kitchen, less fingers in the pie.

Good thread...

Avi, January 23, 2009 - 7:00 am UTC

Hi Tom,

Many a time same questions arose in my mind and I got answer here in this thread...
Thanks for providing accurate information to DBAs from all over the world.