TEMPORARY UNDO
Each
Oracle database contains a set of system related tablespaces, such as,
SYSTEM, SYSAUX, UNDO & TEMP, and each are used for different
purposes within the Oracle database. Pre Oracle 12c R1, undo records
generated by the temporary tables used to be stored in undo tablespace,
much similar to a general/persistent table undo records. However, with
the temporary undo feature in 12c R1, the temporary undo records can now
be stored in a temporary table instead of stored in undo tablespace.
The prime benefits of temporary undo includes: reduction in undo
tablespace and less redo data generation as the information won’t be
logged in redo logs. You have the flexibility to enable the temporary
undo option either at session level or database level.
Enabling temporary undo
To be able to use the new feature, the following needs to be set:
- Compatibility parameter must be set to 12.0.0 or higher
- Enable TEMP_UNDO_ENABLED initialization parameter
- Since the temporary undo records now stored in a temp tablespace, you need to create the temporary tablespace with sufficient space
- For session level, you can use: ALTER SESSION SET TEMP_UNDO_ENABLE=TRUE;
Query temporary undo information
The dictionary views listed below are used to view/query the information/statistics about the temporary undo data:
- V$TEMPUNDOSTAT
- DBA_HIST_UNDOSTAT
- V$UNDOSTAT
To disable the feature, you simply need to set the following:
SQL> ALTER SYSTEM|SESSION SET TEMP_UNDO_ENABLED=FALSE;
No comments:
Post a Comment