0% found this document useful (0 votes)
91 views

Database Administration & Management: Managing UNDO Data Managing UNDO Data

- The document discusses managing undo data in an Oracle database. It describes how Oracle automatically manages undo data by default starting in Oracle 11g. However, DBAs may need to perform some undo management tasks to ensure the success of Oracle Flashback operations. - The key aspects of undo data that are covered include how it is used for rollbacks, read consistency, and enabling Flashback features. Automatic undo management stores undo data in an undo tablespace. - The document provides guidance on configuring the undo retention period and changing an undo tablespace to a fixed size to better support Flashback operations if needed. It describes using the Undo Advisor in Oracle Enterprise Manager to help determine the optimal size for a

Uploaded by

Hafiz Muneeb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views

Database Administration & Management: Managing UNDO Data Managing UNDO Data

- The document discusses managing undo data in an Oracle database. It describes how Oracle automatically manages undo data by default starting in Oracle 11g. However, DBAs may need to perform some undo management tasks to ensure the success of Oracle Flashback operations. - The key aspects of undo data that are covered include how it is used for rollbacks, read consistency, and enabling Flashback features. Automatic undo management stores undo data in an undo tablespace. - The document provides guidance on configuring the undo retention period and changing an undo tablespace to a fixed size to better support Flashback operations if needed. It describes using the Undo Advisor in Oracle Enterprise Manager to help determine the optimal size for a

Uploaded by

Hafiz Muneeb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 39

Database Administration & Management

Managing UNDO Data


Lecture: 22
Farhad
Farhad Muhammad
Muhammad Riaz
Riaz
University
University Institute
Institute of
of Information
Information Technology
Technology (UIIT)
(UIIT)

[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

 Change the undo tablespace to a fixed size


  
 For an autoextending undo tablespace, Oracle
Database always automatically tunes the undo
retention period to be slightly longer than the
longest-running active query.
 However, this autotuned retention period may
be insufficient to accommodate Oracle
Flashback operations.
 If the undo tablespace has autoextending
disabled, or has a fixed size, then Oracle
Database uses a different method for tuning the
undo retention period to better accommodate
Oracle Flashback operations.
 To change the undo tablespace to a fixed size, you must choose a
tablespace size that is sufficiently large. If you choose an undo
tablespace size that is too small, then the following errors could
occur:
 DML could fail because there is not enough space to accommodate undo data
for new transactions.
 Long-running queries could fail with a snapshot too old error, which means
that there was insufficient undo data for read consistency.

 Oracle Enterprise Manager Database Express (EM Express) includes


an Undo Advisor to help you determine the minimum size for the
fixed size of the undo tablespace
Viewing Undo Information
 You can use the Undo Management Details
page in Oracle Enterprise Manager Database
Express (EM Express) to view the following
information about your undo configuration:
 Name and current size of the undo tablespace
 Auto extensible tablespace setting (Yes or No)
 Current undo retention period
 To view undo information:
 In EM Express, from the Storage menu,
select Undo Management. The Undo Management
Details page appears.
 View the undo management information on the
Undo Management Details page.
The Undo Advisor
 If you must change the undo tablespace to a fixed size, then use the
Undo Advisor in Oracle Enterprise Manager Database Express (EM
Express) to help determine the minimum required size. 
 You can also use the Undo Advisor to set the minimum undo
retention period.
 To configure the undo tablespace to have a fixed size, Oracle
suggests that you first allow enough time after database creation to
run a full workload, thus allowing the undo tablespace to grow to its
minimum required size to handle the workload.
 Then, you can use the Undo Advisor to determine the best size to
configure the undo tablespace to allow for future long-running
queries and Oracle Flashback operations.
  
 To compute the minimum undo tablespace
size using the Undo Advisor:
 In EM Express, go to the Undo Management Details
page.See "Viewing Undo Information".
 In the Configuration section, view the Undo Advisor
graph • This is an image of the Undo Advisor, which is
a graph.
• The x-axis is labeled "Undo Retention Time,"
and the time is shown in seconds.
• The origin is labeled 0, and 2,000 and 4,000
are also labeled. The y-axis is labeled "Undo
Tablespace Size".
• The original is labeled 0, and there are labels
for 2 MB, 4 MB, 6 MB, and so on up to 20 MB.
• At the top right of the graph is a blue circle
labeled Target.
• The graph has an orange line plotted on it, and
a blue tick-mark, or point represents the target
undo retention time that is currently set for the
database.
• The orange line has other tick-marks on it,
which you can click.
 The Undo Advisor displays an orange line.
There are several tick-marks, or points, that
you can click on the orange line.
 The blue point on the orange line marks the
target undo retention time that is currently set
for the database.
 To determine the recommended minimum size
of the undo tablespace for a particular undo
retention time, select the point on the orange
line closest to the desired undo retention time.
 In the following figure, for example, the point
on the orange line for the undo retention time
of 3884 seconds has been clicked:
• This is an image of the Undo Advisor,
which is a graph. The x-axis is labeled
"Undo Retention Time," and the time is
shown in seconds. The origin is labeled
0, and 2,000 and 4,000 are also labeled.
• The y-axis is labeled "Undo Tablespace
Size".
• The original is labeled 0, and there are
labels for 2 MB, 4 MB, 6 MB, and so on
up to 20 MB. At the top right of the
graph is a blue circle labeled Target.
• The graph has an orange line plotted on
it, and a blue tick-mark, or point
represents the target undo retention time
that is currently set for the database.
• The point on the orange line that has
been clicked has caused the following to
display in the Undo Advisor: "Undo
Retention Time: 3884s (1 hour, 4
minutes, 44 seconds)" and "Undo
Tablespace Size: 20MB."
Changing the Undo Tablespace to a Fixed Size
 You change the undo tablespace to a fixed size to prevent the tablespace from
growing too large or to better support Oracle Flashback operations. You can use
Oracle Enterprise Manager Database Express (EM Express) to change the undo
tablespace to a fixed size.
 To change the undo tablespace to a fixed size:
1. In EM Express, go to the Undo Management Details page, as
described in "Viewing Undo Information".
2. After determining the minimum required undo tablespace size,
click the link after the Name field in the Tablespace section.
The Tablespace page appears, with the undo tablespace
displayed.
3. Select the undo tablespace. Then from the Actions menu,
select Resize. The Resize Tablespace page appears.
4. In the File Size field, enter the computed minimum size for
the undo tablespace.
5. Click OK.A confirmation message appears
Changing the Datafiles for an Undo Tablespace
to a Fixed Size
 To change the datafiles for an undo tablespace to a
fixed size:
1. In EM Express, go to the Undo Management Details page, as
described in "Viewing Undo Information".
2. After determining the minimum required undo tablespace size,
click the link after the Name field in the Tablespace section. The
Tablespace page appears, with the undo tablespace displayed.
3. Select and expand the undo tablespace. Select one of the
datafiles for the undo tablespace. Then from the Actions menu,
select Resize. The Resize Datafile page appears.
4. In the Size field, enter the computed minimum size for the undo
tablespace.
5. Click OK.A confirmation message appears.
6. You can perform these steps for all the datafiles for the undo
tablespace to change them all to a fixed size.
Changing Undo Management Analysis
Parameters
 To change the analysis period and the undo
retention period:
1. In EM Express, go to the Undo Management Details
page, as described in "Viewing Undo Information".
2. Click Change Analysis Parameters. The Change
Analysis Parameters page appears.
3. To change the analysis period, in the Analysis
Period field, select the desired analysis period.
4. To change the undo retention period, select either:
Use Required Undo Retention
5. Specify Undo Retention in Seconds
1. Enter
the number of seconds to use for the retention
period in the text box.
Switching Undo Tablespaces
 To switch the undo tablespace:
1. In EM Express, go to the Undo Management Details
page, as described in "Viewing Undo Information".
2. Click Switch Undo Tablespace. The Switch Undo
Tablespace page appears.
3. In the Switch to Undo Tablespace field, select the
name of the undo tablespace you want to switch to.
This field includes the names of available undo
tablespaces for the database. For example, if the
current undo tablespace is named UD1 and you
want to switch to the undo tablespace named UD2,
select UD2 in the Switch to Undo Tablespace field.
4. Click OK.A confirmation message appears.

You might also like