Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 









Oracle undo sizing

Oracle Database Tips by Donald Burleson

Question:  How do I size my UNDO to make sure that all of my Oracle tasks complete successfully?  What are the guidelines for UNDO sizing using the undo_retention and the UNDO tablespace?

Answer:  Undo sizing is straightforward.  The larger your undo tablespace, the more "before images" you can hold for long-running DML (updates, inserts).  The Oracle UNDO tablespace must have enough space to rollback any long-running update.

Given enough time,  Oracle will automatically manage the UNDO usage.

In Oracle, UNDO size can be controlled with the undo_retention parameter and the size of the UNDO tablespace, and the setting for these are determined by the level of DML activity in the database:

SELECT d.undo_size/(1024*1024) "ACTUAL UNDO SIZE [MByte]",
       SUBSTR(e.value,1,25) "UNDO RETENTION [Sec]",
       (TO_NUMBER(e.value) * TO_NUMBER(f.value) *
       g.undo_block_per_sec) / (1024*1024)
       "NEEDED UNDO SIZE [MByte]"
  FROM (

       SELECT SUM(a.bytes) undo_size
         FROM v$datafile a,
              v$tablespace b,
              dba_tablespaces c
        WHERE c.contents = 'UNDO'
          AND c.status = 'ONLINE'
          AND = c.tablespace_name
          AND a.ts# = b.ts#
       ) d,

       v$parameter e,
       v$parameter f,
       SELECT MAX(undoblks/((end_time-begin_time)*3600*24))
         FROM v$undostat
       ) g

 WHERE = 'undo_retention'
  AND = 'db_block_size'

Also, note that the automatic undo management feature introduced in Oracle 9i has been improved with the following capabilities.

Some of the undo management related initialization parameters are eliminated in Oracle Database 10g as they are automatically calculated. They include max_rollback_segment, row_locking, undo_suppress_errors, serializable, and transaction_auditing.

This script is useful in determining a HWM for sessions, for UNDO sizing:

rem session.sql - displays all connected sessions
set echo off;
set termout on;
set linesize 80;
set pagesize 60;
set newpage 0;

rpad(||':',11)||rpad(' current logons='||
(to_number(b.sessions_current)),20)||'cumulative logons='||
rpad(substr(a.value,1,10),10)||'highwater mark='||
b.sessions_highwater Information
v$sysstat a,
v$license b,
v$database c
where = 'logons cumulative'

ttitle "dbname Database|UNIX/Oracle Sessions";

set heading off;
select 'Sessions on database '||substr(name,1,8) from v$database;
set heading on;
substr(a.spid,1,9) pid,
substr(b.sid,1,5) sid,
substr(b.serial#,1,5) ser#,
substr(b.machine,1,6) box,
substr(b.username,1,10) username,
-- b.server,
substr(b.osuser,1,8) os_user,
substr(b.program,1,30) program
   v$session b,
   v$process a
b.paddr = a.addr
and type='USER'
order by spid;
ttitle off;
set heading off;
''''||'SID, SER#'||''''||';' from dual;
spool off;


Capacity planning for UNDO Segments

UNDO segments are used to store information on changed rows until those rows are rolled back or committed. If a rollback occurs, either from manual initiation using a ROLLBACK command or due to abnormal termination of a user process due to errors or failures, the data in the UNDO segment is used to restore the database to the state before the transaction began.

The care and feeding or UNDO segments is another empirical process. A few general observations on undo sizing:

1. If your users are doing heavy DML operations make sure there are enough properly sized rollback segment extents to allow each user performing DML to have an UNDO  segment extent without waiting.

2. If you expect heavy DML loads, have multiple UNDO tablespaces spread across multiple disk arrays.

3. Set the default sizing in a UNDO tablespace such that you can simply issue a CREATE ROLLBACK SEGMENT command specifying the tablespace and you don't have to worry about the STORAGE specification.

4. Try to limit the number of simultaneous users per UNDO to four. Size rollback segments such that:

a.  INITIAL=NEXT=size of average transaction 

b. OPTIMAL=size of average large transaction (rounded up to the next NEXT value) 


5. For large batch transactions create special large extent rollback segments in a separate tablespace from the other rollback segments, only bring them online when needed and use SET TRANSACTION command to assign them to specific transactions.

6. Try to avoid running large batch transactions simultaneously with OLTP or smaller transactions.

Generally you won't know the size of the average transaction, average large transaction or number of simultaneous DML users until the application has been running for a while. Use the DBA_ROLLBACK_SEGS, V$ROLLSTAT and V$ROLLNAME views to calculate the average values.

UNDO segments are sized and assigned in a round-robin methodology. Each user gets assigned one extent to begin with which is used in a circular fashion if possible. When a user overwrites his own data it is called a WRAP. If the users data needs exceed the size of one UNDO extent then a second is assigned, this is called an EXTEND.

When a user forces a rollback segment to extend beyond the OPTIMAL setting for that rollback segment, the next user to use the rollback segment must wait for the rollback segment to go back to the OPTIMAL setting, this is called a SHRINK.

When a WRAP, EXTEND or SHRINK occurs this results in an UNDO WAIT (either block or header) condition. A WRAP causes a very minor wait, an EXTEND into a newly assigned extent a slightly more expensive wait and the SHRINK the most expensive wait. By properly sizing rollback segment extents virtually all waits will be of the lower expense WRAP and EXTEND type and not the SHRINK type. Ideally all UNDO WAIT conditions should be caused by WRAP situations.




Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster


Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.