less07 undo tb

Upload: yairr

Post on 30-May-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 Less07 Undo Tb

    1/20

    7Copyright 2005, Oracle. All rights reserved.

    Managing Undo Data

  • 8/14/2019 Less07 Undo Tb

    2/20

    7-2 Copyright 2005, Oracle. All rights reserved.

    Objectives

    After completing this lesson, you should be able to dothe following: Explain DML and redo data generation

    Monitor and administer undo data Describe the difference between undo data and

    redo data Configure undo retention

    Guarantee undo retention Use the Undo Advisor

  • 8/14/2019 Less07 Undo Tb

    3/20

    7-3 Copyright 2005, Oracle. All rights reserved.

    Data Manipulation

    Data manipulation language (DML) consists of thefollowing SQL statements: INSERT

    UPDATE DELETE MERGE

    DML always executes as part of a transaction,which can be: Rolled back, using the ROLLBACK command Committed, using the COMMITcommand

  • 8/14/2019 Less07 Undo Tb

    4/20

    7-4 Copyright 2005, Oracle. All rights reserved.

    Data Manipulation and Redo Data

    Block 1 Block 3Block 2

    SQL> COMMIT;

    Redo log file

    Verify that redo data is on the

    disk and write COMMITrecord

    Write verified, COMMITrecord written, control returned

    SQL>

    SQL> DELETE FROM employees WHERE salary > 10000;

    SQL> UPDATE employeesSET salary = 5000

    WHERE employee_id = 202;

  • 8/14/2019 Less07 Undo Tb

    5/20

    7-5 Copyright 2005, Oracle. All rights reserved.

    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 and flashback queries

    Recovery from failed transactions

    User

  • 8/14/2019 Less07 Undo Tb

    6/20

    7-6 Copyright 2005, Oracle. All rights reserved.

    Undo DataFull Notes Page

  • 8/14/2019 Less07 Undo Tb

    7/207-7 Copyright 2005, Oracle. All rights reserved.

    Transactions and Undo Data

    Each transaction is assignedto only one undo segment.

    An undo segment can service

    more than one transaction at atime.

    Updatetransaction

    Old value

    New

    valueUndo segment

    Table

  • 8/14/2019 Less07 Undo Tb

    8/207-8 Copyright 2005, Oracle. All rights reserved.

    Storing Undo Information

    Undo information is stored in undo segments, whichare, in turn, stored in an undo tablespace. Undotablespaces:

    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 atany given time

  • 8/14/2019 Less07 Undo Tb

    9/207-9 Copyright 2005, Oracle. All rights reserved.

    Undo Data Versus Redo Data

    Inconsistent reads in multiuser systems

    Undo segments

    Rollback, read-consistency,

    and flashback

    How to undo a change

    Undo

    Protectsagainst

    Stored in

    Used for

    Record of

    Recovery, to roll

    forward databasechanges

    Redo log files

    Data loss

    How to reproduce achange

    Redo

  • 8/14/2019 Less07 Undo Tb

    10/207-10 Copyright 2005, Oracle. All rights reserved.

    Monitoring Undo

    Undo usually requires little management. The areas tomonitor include: Free space in an undo tablespace

    Snapshot too old errors

    DBA

  • 8/14/2019 Less07 Undo Tb

    11/207-11 Copyright 2005, Oracle. All rights reserved.

    Monitoring UndoFull Notes Page

  • 8/14/2019 Less07 Undo Tb

    12/20

  • 8/14/2019 Less07 Undo Tb

    13/207-13 Copyright 2005, Oracle. All rights reserved.

    Configuring Undo Retention

    DBA

    UNDO_RETENTIONspecifies (in seconds) the amount of already committed undo information that is to beretained. The only time you must set this parameter iswhen: The undo tablespace has the AUTOEXTEND option

    enabled You want to set undo retention for LOBs You want to guarantee retention

  • 8/14/2019 Less07 Undo Tb

    14/20

  • 8/14/2019 Less07 Undo Tb

    15/207-15 Copyright 2005, Oracle. All rights reserved.

    Guaranteeing Undo Retention

    Guarantee: 15 minutes

    A transaction that generatesmore undo than what there

    is space for will fail.

    Undo data

    SELECT statementsrunning 15 minutes or less

    are always satisfied.

  • 8/14/2019 Less07 Undo Tb

    16/207-16 Copyright 2005, Oracle. All rights reserved.

    Sizing the Undo Tablespace

    Current table-space size

    Undo consumption rate

  • 8/14/2019 Less07 Undo Tb

    17/207-17 Copyright 2005, Oracle. All rights reserved.

    Using the Undo Advisor

  • 8/14/2019 Less07 Undo Tb

    18/207-18 Copyright 2005, Oracle. All rights reserved.

    Summary

    In this lesson, you should have learned how to: Explain DML and redo data generation Monitor and administer undo segments

    Configure undo retention Guarantee undo retention Use the Undo Advisor

  • 8/14/2019 Less07 Undo Tb

    19/207-19 Copyright 2005, Oracle. All rights reserved.

    Practice Overview:Managing Undo Segments

    This practice covers the following topics: Calculating undo tablespace sizing to support a

    48-hour retention interval

    Modifying an undo tablespace to support a 48-hour retention interval

  • 8/14/2019 Less07 Undo Tb

    20/20