0% found this document useful (0 votes)
8 views21 pages

D78846GC20 09

The document provides an overview of managing undo data in Oracle databases, including its generation, storage, and differences from redo data. It covers topics such as configuring undo retention, enabling temporary undo, and using the Undo Advisor for monitoring. Key objectives include understanding undo data's role in transactions, rollback operations, and ensuring data consistency.

Uploaded by

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

D78846GC20 09

The document provides an overview of managing undo data in Oracle databases, including its generation, storage, and differences from redo data. It covers topics such as configuring undo retention, enabling temporary undo, and using the Undo Advisor for monitoring. Key objectives include understanding undo data's role in transactions, rollback operations, and ensuring data consistency.

Uploaded by

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

Managing Undo Data

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.


Objectives

After completing this lesson, you should be able to:


• Explain DML and undo data generation
• Monitor and administer undo data
• Describe the difference between undo data and redo data
• Configure undo retention
• Guarantee undo retention
• Enable temporary undo
• Use the Undo Advisor

9-2 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Undo Data: Overview

Undo data is:


• A record of the action of a transaction
• Captured for every transaction that changes data
• Retained at least until the transaction is ended
• Used to support:
– Rollback operations
– Read-consistent queries
– Oracle Flashback Query, Oracle Flashback
Transaction, and Oracle Flashback Table
– Recovery from failed transactions

User

9-3 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Transactions and Undo Data

Undo
segment
Data in Undo “old” data
buffer cache in undo tablespace

Redo log New change details


buffer Redo log
UPDATE in redo log files files
DML operations

• Each transaction is assigned to only one undo segment.


• An undo segment can service more than one transaction
at a time.

9-5 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Storing Undo Information

• Undo information is stored in undo segments, which are


stored in an undo tablespace.
• Undo tablespaces:
– Are used only for undo segments
– Have special recovery considerations
– May be associated with only a single instance
– Require that only one of them be the current writable undo
tablespace for a given instance at any given time

9-6 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Comparing Undo Data and Redo Data

Undo Redo

Record of How to undo a change How to reproduce a


change
Used for Rollback, read consistency, Rolling forward
flashback database changes
Stored in Undo segments Redo log files

Undo
segment
Redo log
files

9-7 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Managing Undo

Automatic undo management:


• Fully automated management of undo data and space in a
dedicated undo tablespace
• For all sessions
• Self-tuning in AUTOEXTEND tablespaces to satisfy long-
running queries
• Self-tuning in fixed-size tablespaces for best retention
DBA tasks in support of Flashback operations:
• Configuring undo retention
• Changing undo tablespace to a fixed size
• Avoiding space and “snapshot too old” errors

9-8 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Configuring Undo Retention

• UNDO_RETENTION specifies (in seconds) how long already


committed undo information is to be retained.
• Set this parameter when:
– The undo tablespace has the AUTOEXTEND option enabled
– You want to set undo retention for LOBs
– You want to guarantee retention

DBA

9-9 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Categories of Undo

Category Description

Active: Uncommitted undo Supports an active transaction and is never


information overwritten
Unexpired: Committed undo Required to meet the undo retention interval
information
Expired: Expired undo Overwritten when space is required for an active
information transaction

9 - 10 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.


Guaranteeing Undo Retention

SQL> ALTER TABLESPACE undotbs1 RETENTION GUARANTEE;

Retention guarantee:
15 minutes

Undo data in
undo
tablespace
SELECT statements A transaction will fail
running 15 minutes or less if it generates more undo
are always satisfied. than there is space.
Note: This example is based on an UNDO_RETENTION setting of 900 seconds (15
minutes).

9 - 11 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.


Changing an Undo Tablespace to a Fixed Size

• Rationale:
– Supporting Flashback operations
– Limiting tablespace growth
• Steps:
1. Run regular workload.
2. Self-tuning mechanism establishes minimum required size.
3. (Optional) Use the Enterprise Manager Cloud Control Undo
Advisor, which calculates required size for future growth.
4. (Optional) Change undo tablespace to a fixed size.

9 - 12 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.


Temporary Undo: Overview

Stored in Stored in
temporary user
tablespace tablespace

If using If not using


temporary undo Temporary temporary undo Persistent
Table Table

Temporary Permanent Redo


Undo Undo

Stored in Stored in Stored in


temporary tablespace undo tablespace redo log files

9 - 13 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.


Temporary Undo: Benefits

• Temporary undo reduces the amount of undo stored in the


undo tablespaces.
• Temporary undo reduces the size of the redo log.
• Temporary undo enables DML operations on temporary
tables in a physical standby database with the Oracle
Active Data Guard option.

9 - 14 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.


Enabling Temporary Undo

• Enable temporary undo for a session:


SQL> ALTER session SET temp_undo_enabled = true;

• Enable temporary undo for the database instance:

SQL> ALTER system SET temp_undo_enabled = true;

• Temporary undo mode is selected when a session first


uses a temporary object.

9 - 15 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.


Monitoring Temporary Undo

SELECT to_char(BEGIN_TIME,'dd/mm/yy hh24:mi:ss'),


TXNCOUNT,MAXCONCURRENCY,UNDOBLKCNT,USCOUNT,NOSPACEERRCNT
FROM V$TEMPUNDOSTAT;

TO_CHAR(BEGIN_TIM TXNCOUNT MAXCONCURRENCY UNDOBLKCNT USCOUNT NOSPACEERRCNT


----------------- -------- -------------- ---------- ------- -------------

19/08/12 22:19:44 0 0 0 0 0
19/08/12 22:09:44 0 0 0 0 0

19/08/12 13:09:44 0 0 0 0 0
19/08/12 12:59:44 3 1 24 1 0

576 rows selected.

SQL>

9 - 16 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.


Viewing Undo Information

9 - 17 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.


Viewing Undo Activity

9 - 18 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.


Using the Undo Advisor

9 - 19 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.


Quiz

All you need to do to guarantee that all queries under 15


minutes will find the undo data needed for read consistency, is
set the UNDO_RETENTION parameter to 15 minutes.
a. True
b. False

9 - 20 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.


Summary

In this lesson, you should have learned how to:


• Explain DML and undo data generation
• Monitor and administer undo data
• Describe the difference between undo data and redo data
• Configure undo retention
• Guarantee undo retention
• Enable temporary undo
• Use the Undo Advisor

9 - 21 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.


Practice: Overview

This practice covers the following topics:


• Viewing system activity
• Calculating undo tablespace sizing to support a 48-hour
retention interval
• Modifying an undo tablespace to support a 48-hour
retention interval

9 - 22 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy