Database Administration & Management: Managing UNDO Data Managing UNDO Data
Database Administration & Management: Managing UNDO Data Managing UNDO Data
[email protected]
1
Lecture Objectives
UNDO Data
When a transaction modifies data, Oracle
Database copies the original data
before modifying it.
The original copy of the modified data is
called undo data.
Saving this information is necessary for the
following reasons
Beginning with Oracle Database Release 11g,
for a default installation, Oracle Database
automatically manages the undo data.
There is typically no need for DBA intervention.
However, if your installation uses Oracle
Flashback operations, you may need to perform
some undo management tasks to ensure the
success of these operations.
• To undo any uncommitted changes made to the database if a
rollback is necessary.
• A rollback can be needed because a user wants to undo the changes of a
misguided or unintentional transaction, or it can be part of a recovery
operation.
• To provide read consistency, which means that each user can get a
consistent view of data, even while other changes may be occurring
against the data.
• With read consistency, a user session does not see uncommitted changes
made in other user sessions (sometimes referred to as dirty reads).
• For example, if a user issues a query at 10:00 a.m. and the query lasts for
15 minutes, then the query results reflect the entire state of the data at
10:00 a.m., regardless of update or insert operations performed by other
users after the query started.
• To enable certain Oracle Flashback features, such as Oracle
Flashback Query and Oracle Flashback Table, which enable you to
view or recover data to a previous point in time.
Transactions and Undo Data
Storing UNDO Information
UNDO Data Versus REDO Data
Managing UNDO
Undo Tablespace
With automatic undo management, undo data is stored in an undo
tablespace. Undo tablespaces have additional properties beyond
those of permanent tablespaces.
There can be multiple undo tablespaces, but only one can be active
for an Oracle instance.
When you create the database using Database Configuration
Assistant (DBCA), it creates an autoextending undo tablespace
named UNDOTBS1, with a maximum extension size of 32,767 MB.
Undo Retention
Oracle Database automatically ensures that undo data that is in use by an
active transaction is never overwritten until that transaction has been
committed.
After the transaction has been committed, the space occupied by that undo
data can be reused, or overwritten.
In this case, that undo data could be overwritten if space in the undo
tablespace becomes scarce.
Even after a transaction has been committed, it is useful to retain (not
overwrite) its undo data, to ensure the success of Oracle Flashback features and
for read consistency for long-running queries.
To this end, the database maintains and automatically tunes an undo retention
period.
Committed undo data whose age is less than the undo retention period is
retained for use by queries or Oracle Flashback operations.
Configuring UNDO Retention
Guaranteeing UNDO Retention
Changing an UNDO Tablespace to a Fixed
Size
General UNDO Information
Using the UNOD Advisor
Viewing System Activity
Mange the UNDO Data in Oracle 11 g
Although by default Oracle Database manages undo data and the
undo tablespace automatically, if your installation uses Oracle
Flashback features, then you may have to perform some undo
management tasks to ensure the success of these operations.
Oracle Flashback operations resulting in snapshot too old errors
indicate that you must intervene to ensure that sufficient undo data
is retained to support these operations.
The following methods better support Oracle Flashback operations:
Set the minimum undo retention period for the autoextending tablespace to be
as long as the longest expected Oracle Flashback operation.
You achieve this goal by setting the UNDO_RETENTION initialization parameter