When automatic undo management is enabled, there is always a current undo retention period, which is the minimum amount of time that the Oracle Database attempts to retain old undo information before overwriting it. Old (committed) undo information that is older than the current undo retention period is said to be expired. Old undo information with an age that is less than the current undo retention period is said to be unexpired.
Oracle Database automatically tunes the undo retention period based on undo tablespace size and system activity. You can specify a minimum undo retention period (in seconds) by setting the undo_retention initialization parameter.
The database makes its best effort to honor the specified minimum undo retention period, provided that the undo tablespace has space available for new transactions.
When available space for new transactions becomes short, the database begins to overwrite expired undo. If the undo tablespace has no space for new transactions after all expired undo is overwritten, the database may begin overwriting unexpired undo information.
If any of this overwritten undo information is required for consistent read in a current long-running query, the query could fail with the snapshot too old error message.
[Related Article: Oracle Database Administrator Tutorial]
The following points explain the exact impact of the undo_retention parameter on undo retention:
To guarantee the success of long-running queries or oracle flashback operations, you can enable retention guarantee. If retention guarantee is enabled, the specified minimum undo retention is guaranteed; the database never overwrites unexpired undo data even if it means that transactions fail due to lack of space in the undo tablespace.
If the retention guarantee is not enabled, the database can overwrite unexpired undo when space is low, thus lowering the undo retention for the system. This option is disabled by default.
[Related Article: Oracle DBA Interview Questions]
Enabling retention guarantee can cause multiple DML operations to fail.
You enable retention guarantee by specifying the retention guarantee clause for the undo tablespace when you create it with either the create a database or create an undo tablespace statement. Or, you can later specify this clause in an alter tablespace statement. You disable the retention guarantee with the retention no guarantee clause.
You can use the dba_tablespaces view to determine the retention guarantee setting for the undo tablespace. A column named retention contains a value of guarantee, no guarantee, or not apply (used for tablespaces other than the undo tablespace).
Explore Oracle DBA Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download Now!
Technical Content Writer