Optimal size of rollback segments

This script displays the optimal size of rollback segments created in Oracle databases.

This script displays the optimal size of rollback segments created in the database.

-- -------------------------------
-- Marcelo Castanho
-- [email protected]
-- -------------------------------
-- Rollback Segments (Optimal Size)
-- -------------------------------
column "Segment Name" format a15
column "Optimal Size" format 999,999,999,999
column "Status" format a25

spool optimal_size
select a.name "Segment Name",
       b.optsize "Optimal Size",
       b.status "Status"
from   v$rollname a,
       v$rollstat b
where a.usn=b.usn
spool off

Reader Feedback

Jay W. writes: "I can appreciate the value of reporting the "what is" size of optimal rollback. What would be really useful to me is a tip to help me tune what the optimal rollback size should be."

Ashok T. writes: "I am not getting any optimal size value from this query."

Rohit D. writes: I agree with comments of Jay W. I thought the tip would tell me how to tune and arrive at optimal size and not just to find existing values. So, I'd like to share a query and a matrix of actions to tune optimal size.

1. Query:

select a.name, b.extents, b.rssize,
 b.optsize, b.shrinks, b.aveshrink,
 b.aveactive, b.wraps, b.extends, b.status
from v$rollname a, v$rollstat b
where a.usn = b.usn;
2. Here is the matrix:
-------		---------	---------------------------------
High 		High		Too low, increase optimal 
High 		Low		Too low, increase optimal 
Low		Low		Too high, reduce optimal 
				(unless nearly equal to AVEACTIVE)

Low		High		OK

This matrix gives an indication of when and how to tune the optimal size of rollback segments. Essentially, when the number of "SHRINKS" is low and the "AVGSHRINK" size in bytes is high, the size of rollback segments is considered "optimized."

If you need to know the reference, it's "DBA Certification Exam Guide" by Jason S. Couchman (Oracle Press).

Jose M. writes: "The problem with this tip is that it's of little value; it's like telling a car mechanic where to find the carburetor on an engine. If you understand what "optimal size of rollback segments" means then you most definitely know where to find it."

For More Information

  • What do you think about this tip? E-mail the Editor at [email protected] with your feedback.
  • The Best Oracle Web Links: tips, tutorials, scripts, and more.
  • Have an Oracle tip to offer your fellow DBA's and developers? The best tips submitted will receive a cool prize--submit your tip today!
  • Ask your technical Oracle questions--or help out your peers by answering them--in our live discussion forums.
  • Check out our Ask the Experts feature: Our SQL, database design, Oracle, SQL Server, DB2, metadata, and data warehousing gurus are waiting to answer your toughest questions.

Dig Deeper on Oracle and SQL