View
255
Download
1
Category
Preview:
Citation preview
7/30/2019 Less10 Undo - Managing Undo Data
1/16
Copyright 2008, Oracle. All rights reserved.
Managing Undo Data
7/30/2019 Less10 Undo - Managing Undo Data
2/16
Copyright 2008, Oracle. All rights reserved.10 - 2
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 redodata
Configure undo retention
Guarantee undo retention
Use the Undo Advisor
7/30/2019 Less10 Undo - Managing Undo Data
3/16
Copyright 2008, Oracle. All rights reserved.10 - 3
Data Manipulation
Data manipulation language (DML) consists of thefollowing SQL statements:
INSERT
UPDATE
DELETE
MERGE
DML always executes as part of a transaction, whichcan be:
Rolled back using the ROLLBACKcommand
Committed using the COMMIT command
7/30/2019 Less10 Undo - Managing Undo Data
4/16
Copyright 2008, Oracle. All rights reserved.10 - 4
Undo Data
Undo data is:
A copy of original, premodified data
Captured for every transaction that changes data
Retained at least until the transaction is ended Used to support:
Rollback operations
Read-consistent queries
Flashback Query, Flashback Transaction, and
Flashback Table
Recovery from failed transactions
User
7/30/2019 Less10 Undo - Managing Undo Data
5/16
Copyright 2008, Oracle. All rights reserved.10 - 6
Transactions and Undo Data
Each transaction is assigned to only one undosegment.
An undo segment can service more than onetransaction at a time.
Data in Undo old data
in undo tablespace
UPDATE
DML operations
buffer cache
Redo logbuffer Redo log
files
New change details
in Redo log files
Undosegment
7/30/2019 Less10 Undo - Managing Undo Data
6/16
Copyright 2008, Oracle. All rights reserved.10 - 7
Storing Undo Information
Undo information is stored in undo segments, which arestored 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 writableundo tablespace for a given instance at any given time
7/30/2019 Less10 Undo - Managing Undo Data
7/16Copyright 2008, Oracle. All rights reserved.10 - 8
Undo Data Versus Redo Data
Undo Redo
Record of How to undo a change How to reproduce achange
Used for Rollback, read consistency,
flashback
Rolling forward
database changes
Stored in Undo segments Redo log files
Protectsagainst
Inconsistent reads inmultiuser systems
Data loss
Redo logfiles
Undosegment
7/30/2019 Less10 Undo - Managing Undo Data
8/16Copyright 2008, Oracle. All rights reserved.10 - 9
Managing Undo
Automatic undo management:
Fully automated management of undo data and spacein a dedicated undo tablespace
For all sessions
Self-tuning inAUTOEXTEND 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
7/30/2019 Less10 Undo - Managing Undo Data
9/16Copyright 2008, Oracle. All rights reserved.10 - 10
Configuring Undo Retention
UNDO_RETENTION specifies (in seconds) how long already
committed undo information is to be retained. The onlytime you must set this parameter is when:
The undo tablespace has theAUTOEXTEND option
enabled
You want to set undo retention for LOBs
You want to guarantee retention
DBA
7/30/2019 Less10 Undo - Managing Undo Data
10/16Copyright 2008, Oracle. All rights reserved.10 - 12
Guaranteeing Undo Retention
A transaction will failif it generates more undo
than there is space.
SELECT statements
running 15 minutes or lessare always satisfied.
Undo data inundo
tablespace
Retention guarantee:
15 minutes
7/30/2019 Less10 Undo - Managing Undo Data
11/16Copyright 2008, Oracle. All rights reserved.10 - 13
Changing an Undo Tablespaceto a Fixed Size
Reasons:
Supporting Flashback operations
Limiting tablespace growth
Workflow:1. Run regular workload.
2. Self-tuning mechanism establishes minimum requiredsize.
3. (Optional) Use Undo Advisor, which calculatesrequired size for future growth.
4. (Optional) Change undo tablespace to a fixed size.
7/30/2019 Less10 Undo - Managing Undo Data
12/16Copyright 2008, Oracle. All rights reserved.10 - 14
General Undo Information
Current
tablespace size
7/30/2019 Less10 Undo - Managing Undo Data
13/16Copyright 2008, Oracle. All rights reserved.10 - 15
Using the Undo Advisor
7/30/2019 Less10 Undo - Managing Undo Data
14/16Copyright 2008, Oracle. All rights reserved.10 - 16
Viewing System Activity
3
1
2
7/30/2019 Less10 Undo - Managing Undo Data
15/16Copyright 2008, Oracle. All rights reserved.10 - 17
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 redodata
Configure undo retention
Guarantee undo retention
Use the Undo Advisor
7/30/2019 Less10 Undo - Managing Undo Data
16/16C i ht 2008 O l All i ht d10 18
Practice 10 Overview:Managing Undo Segments
This practice covers the following topics:
Viewing system activity
Calculating undo tablespace sizing to support a48-hour retention interval
Modifying an undo tablespace to support a48-hour retention interval
Recommended