Managing the UNDO TABLESPACE

Every Oracle Database must have a method of maintaining information that is used to roll back, or undo, changes to the database. Such information consists of records of the actions of transactions, primarily before they are committed. These records are collectively referred to as undo.
Undo records are used to:
  • Roll back transactions when a ROLLBACK statement is issued
  • Recover the database
  • Provide read consistency
  • Analyze data as of an earlier point in time by using Flashback Query
  • Recover from logical corruptions using Flashback features
Earlier releases of Oracle Database used rollback segments to store undo. Oracle9i introduced automatic undo management, which simplifies undo space management by eliminating the complexities associated with rollback segment management. Oracle strongly recommends that you use undo tablespace to manage undo rather than rollback segments.
Switching to Automatic Management of Undo Space
To go for automatic management of undo space set the following parameter.
Steps:-
  1. If you have not created an undo tablespace at the time of creating a database then, create an undo tablespace by typing the following command
SQL>create undo tablespace myundo datafile 
         ‘/u01/oracle/ica/undo_tbs.dbf’ size 500M
                        autoextend ON next 5M ;

When the system is first running in the production environment, you may be unsure of the space requirements of the undo tablespace. In this case, you can enable automatic extension for datafiles of the undo tablespace so that they automatically increase in size when more space is needed

  1. Shutdown the Database and set the following parameters in parameter file.
UNDO_MANAGEMENT=AUTO
UNDO_TABLESPACE=myundo
  1. Start the Database.

Now Oracle Database will use Automatic Undo Space Management.
Calculating the Space Requirements For Undo Retention
You can calculate space requirements manually using the following formula:
UndoSpace = UR * UPS + overhead
where:
  • UndoSpace is the number of undo blocks
  • UR is UNDO_RETENTION in seconds. This value should take into consideration long-running queries and any flashback requirements.
  • UPS is undo blocks for each second
  • overhead is the small overhead for metadata (transaction tables, bitmaps, and so forth)
As an example, if UNDO_RETENTION is set to 3 hours, and the transaction rate (UPS) is 100 undo blocks for each second, with a 8K block size, the required undo space is computed as follows:
(3 * 3600 * 100 * 8K) = 8.24GBs
To get the values for UPS, Overhead query the V$UNDOSTAT view. By giving the following statement
SQL> Select * from V$UNDOSTAT;

Enregistrer un commentaire

0 Commentaires