6 Copyright © 2006, Oracle. All rights reserved. Flashback.

Slides:



Advertisements
Similar presentations
17 Copyright © 2005, Oracle. All rights reserved. Performing Flashback.
Advertisements

10 Copyright © 2009, Oracle. All rights reserved. Managing Undo Data.
5 Copyright © 2006, Oracle. All rights reserved. Database Recovery.
RMAN Restore and Recovery
Backup and Recovery (2) Oracle 10g CAP364 1 Hebah ElGibreen.
Backup and Recovery Part 1.
Chapter 12 Performing Incomplete Recovery. Background Viewed as one of the more difficult chapters to write Thought it was important to put in material.
CHAPTER 16 User-Managed Backup and Recovery. Introduction to User Managed Backup and Recovery Backup and recover is one of the most critical skills a.
Configuring Recovery Manager
4 Copyright © 2008, Oracle. All rights reserved. Configuring Backup Specifications.
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
Introduction to Oracle Backup and Recovery
Using RMAN to Perform Recovery
CHAPTER 16 User-Managed Backup and Recovery. Introduction to User Managed Backup and Recovery Backup and recover is one of the most critical skills a.
20 Copyright © 2004, Oracle. All rights reserved. Database Recovery.
13 Copyright © Oracle Corporation, All rights reserved. RMAN Complete Recovery.
7 Copyright © 2006, Oracle. All rights reserved. Dealing with Database Corruption.
5 Copyright © 2004, Oracle. All rights reserved. Using Recovery Manager.
5 Copyright © 2008, Oracle. All rights reserved. Using RMAN to Create Backups.
Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.
11 Copyright © Oracle Corporation, All rights reserved. RMAN Backups.
15 Copyright © 2005, Oracle. All rights reserved. Performing Database Backups.
16 Copyright © 2007, Oracle. All rights reserved. Performing Database Recovery.
9 Copyright © 2004, Oracle. All rights reserved. Flashback Database.
16 Copyright © 2004, Oracle. All rights reserved. Undo Management.
17 Copyright © Oracle Corporation, All rights reserved. Recovery Catalog Creation and Maintenance.
7 Copyright © 2004, Oracle. All rights reserved. Recovering from Noncritical Losses.
15 Copyright © Oracle Corporation, All rights reserved. RMAN Incomplete Recovery.
7 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
11 Copyright © 2004, Oracle. All rights reserved. Dealing with Database Corruption.
10 Copyright © 2004, Oracle. All rights reserved. Recovering from User Errors.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
3 Copyright © 2006, Oracle. All rights reserved. Using Recovery Manager.
10 Copyright © Oracle Corporation, All rights reserved. User-Managed Backups.
Over view  Why Oracle Forensic  California Breach security Act  Oracle Logical Structure  Oracle System Change Number  Oracle Data Block Structure.
© 2006 Northgate Information Solutions plc and its associated companies. All rights reserved. Slide 1.
Overview of Oracle Backup and Recovery Darl Kuhn, Regis University.
12 Copyright © Oracle Corporation, All rights reserved. User-Managed Complete Recovery.
18 Copyright © 2004, Oracle. All rights reserved. Backup and Recovery Concepts.
6 Copyright © 2007, Oracle. All rights reserved. Performing User-Managed Backup and Recovery.
2 Copyright © 2007, Oracle. All rights reserved. Configuring for Recoverability.
2 Copyright © 2006, Oracle. All rights reserved. Configuring Recovery Manager.
16 Copyright © 2005, Oracle. All rights reserved. Performing Database Recovery.
8 Copyright © 2007, Oracle. All rights reserved. Using RMAN to Duplicate a Database.
3 Copyright © 2007, Oracle. All rights reserved. Using the RMAN Recovery Catalog.
18 Copyright © 2004, Oracle. All rights reserved. Recovery Concepts.
7 Copyright © Oracle Corporation, All rights reserved. Instance and Media Recovery Structures.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
11 Copyright © 2007, Oracle. All rights reserved. Using Flashback Technology.
13 Copyright © 2007, Oracle. All rights reserved. Using the Data Recovery Advisor.
20 Copyright © 2006, Oracle. All rights reserved. Best Practices and Operational Considerations.
9 Copyright © 2004, Oracle. All rights reserved. Incomplete Recovery.
What is the Flashback Database? Improves a database’s availability Useful alternative to traditional restoration methods Contains Flashback logs Archived.
6 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
14 Copyright © 2007, Oracle. All rights reserved. Backup and Recovery Concepts.
What is Flashback? Technology that allows you to revert the database to a point in time in the past Several versions of flashback available Different types.
4 Copyright © 2004, Oracle. All rights reserved. Managing the Oracle Instance.
8 Copyright © Oracle Corporation, All rights reserved. Managing Tablespaces and Data files.
23 Copyright © 2004, Oracle. All rights reserved. Preferring the Past: Flashback.
5 Copyright © 2005, Oracle. All rights reserved. Managing the Oracle Instance.
Oracle 10g Administration Database Control and Storage Structures Copyright ©2006 Custom Training Institute.
9 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
10 Copyright © 2007, Oracle. All rights reserved. Managing Undo Data.
Performing Flashback.
Recovering from User Errors
Performing Tablespace Point-in-Time Recovery
Performing Tablespace Point-in-Time Recovery
Using Flashback Technology II
Index Index.
Performing Database Recovery
Presentation transcript:

6 Copyright © 2006, Oracle. All rights reserved. Flashback

6-2 Copyright © 2006, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to: Query the recycle bin Configure Flashback Database Perform Flashback Database to a point in time Monitor flashback log statistics Enable and disable the Flashback Database feature Use the Enterprise Manager Recovery Wizard to perform Flashback Database Use guaranteed restore points with Flashback Database Recycle bin Flashback DB Config. FB DB Monitor FB DB Guar. Res. Pt.

6-3 Copyright © 2006, Oracle. All rights reserved. Flashback Technology: Review Object Level Scenario Examples Flashback TechnologyUses Affects Data DatabaseTruncate table; Undesired multitable changes made DatabaseFlashback logs TRUE TableDrop tableDropRecycle binTRUE Update with the wrong WHERE clause TableUndo dataTRUE Compare current data with data from the past QueryUndo dataFALSE Compare versions of a row VersionUndo dataFALSE TxInvestigate several historical states of data TransactionUndo dataFALSE

6-4 Copyright © 2006, Oracle. All rights reserved. Flashback Drop and the Recycle Bin DROP TABLE employees; FLASHBACK TABLE employees TO BEFORE DROP; Mistake was made. RECYCLEBIN=ON

6-5 Copyright © 2006, Oracle. All rights reserved Recycle Bin DROP TABLE employees; BIN$zbjra9wy==$0EMPLOYEES_PK EMPLOYEES Recycle bin DBA_FREE_SPACE BIN$zbjrBdpw==$0 USER_OBJECTS BIN$zbjrBdpw==$0 EMPLOYEES BIN$zbjra9wy==$0 EMPLOYEES_PK 4 Objects are: – Renamed – Not moved

6-6 Copyright © 2006, Oracle. All rights reserved. Recycle Bin (notes only slide)

6-7 Copyright © 2006, Oracle. All rights reserved. Restoring Tables from the Recycle Bin Restore dropped tables and dependent objects. If multiple recycle bin entries have the same original name: –Use unique, system-generated names to restore a particular version –When using original names, the restored table is last in, first out (LIFO) Rename the original name if that name is currently used. FLASHBACK TABLE TO BEFORE DROP [RENAME TO ];

6-8 Copyright © 2006, Oracle. All rights reserved. Recycle Bin: Automatic Space Reclamation BIN$zbjrBdpw==$0 BIN$zbjra9wy==$0 BIN$zbjra9wy==$0 BIN$zbjrBdpw==$ Recycle bin DBA_FREE_SPACE - RECYCLEBIN Autoextend

6-9 Copyright © 2006, Oracle. All rights reserved. Recycle Bin: Automatic Space Reclamation (notes only slide)

6-10 Copyright © 2006, Oracle. All rights reserved. Recycle Bin: Manual Space Reclamation PURGE {TABLE |INDEX } PURGE TABLESPACE [USER ] PURGE [USER_|DBA_]RECYCLEBIN

6-11 Copyright © 2006, Oracle. All rights reserved. Bypassing the Recycle Bin DROP TABLESPACE [INCLUDING CONTENTS] ; DROP USER [CASCADE] ; DROP TABLE [PURGE] ;

6-12 Copyright © 2006, Oracle. All rights reserved. Querying the Recycle Bin SELECT owner, original_name, object_name, type, ts_name, droptime, related, space FROM dba_recyclebin WHERE can_undrop = 'YES'; SELECT original_name, object_name, type, ts_name, droptime, related, space FROM user_recyclebin WHERE can_undrop = 'YES'; SQL> SHOW RECYCLEBIN

6-13 Copyright © 2006, Oracle. All rights reserved. Querying Data from Dropped Tables SELECT... FROM " BIN$zbjrBdpw==$0" [AS OF...] WHERE... Recycle bin USER_INDEXES YES INDEX_NAMEDROPPED NOSALES_PK USER_TABLES TABLE_NAMEDROPPED YES NOSALES BIN$zbjrBdpw==$0 EMPLOYEES BIN$zbjra9wy==$0 EMPLOYEES_PK

6-14 Copyright © 2006, Oracle. All rights reserved. Flashback Database: Review The Flashback Database operation: Works like a rewind button for the database Can be used in cases of logical data corruptions made by users The database is corrupted. The database is “rewound.” You “press the rewind button.” Users generate errors. Recycle bin >Flashback DB Config. FB DB Monitor FB DB Guar. Res. Pt.

6-15 Copyright © 2006, Oracle. All rights reserved. Flashback Database Architecture Flashback buffer Redo log buffer SGA LGWR RVWR Flashback logs Redo logs …… Buffer cache 1 Log block before images periodically. Back out changes to database using before images. Do forward media recovery. Every change Not every change! 2

6-16 Copyright © 2006, Oracle. All rights reserved. Configuring Flashback Database 1. Configure the flash recovery area. 3. Enable Flashback Database. 2. Set the retention target. SQL> SHUTDOWN IMMEDIATE; SQL> STARTUP MOUNT EXCLUSIVE; SQL> ALTER SYSTEM SET 2DB_FLASHBACK_RETENTION_TARGET=2880 SCOPE=BOTH; SQL> ALTER DATABASE FLASHBACK ON; SQL> ALTER DATABASE OPEN; Recycle bin Flashback DB >Config. FB DB Monitor FB DB Guar. Res. Pt.

6-17 Copyright © 2006, Oracle. All rights reserved. Configuring Flashback Database Using EM Make sure that the database is in ARCHIVELOG mode.

6-18 Copyright © 2006, Oracle. All rights reserved. Configuring Flashback Database Using EM Enable flashback logging and specify the flash recovery area.

6-19 Copyright © 2006, Oracle. All rights reserved. Flashback Database: Examples RMAN> FLASHBACK DATABASE TO TIME = 2> "TO_DATE(' :00:00', 3> 'YYYY-MM-DD HH24:MI:SS')"; RMAN> FLASHBACK DATABASE TO SCN=23565; RMAN> FLASHBACK DATABASE 2> TO SEQUENCE=223 THREAD=1; SQL> FLASHBACK DATABASE 2 TO TIMESTAMP(SYSDATE-1/24); SQL> FLASHBACK DATABASE TO SCN 53943; SQL> FLASHBACK DATABASE TO RESTORE POINT b4_load;

6-20 Copyright © 2006, Oracle. All rights reserved. Performing Flashback Database Using EM Select object and operation type.

6-21 Copyright © 2006, Oracle. All rights reserved. Performing Flashback Database Using EM Launching the Recovery Wizard:

6-22 Copyright © 2006, Oracle. All rights reserved. Performing Flashback Database Using EM

6-23 Copyright © 2006, Oracle. All rights reserved. Excluding Tablespaces from Flashback Database Take the tablespace offline before you perform the Flashback Database recovery. Drop the tablespace or recover the offline files with traditional point-in-time recovery. ALTER TABLESPACE FLASHBACK {ON|OFF} SQL> SELECT name, flashback_on 2 FROM v$tablespace;

6-24 Copyright © 2006, Oracle. All rights reserved. Flashback Database Considerations When the Flashback Database operation completes, open the database: –In read-only mode to verify that the correct target time or SCN was used –With a RESETLOGS operation to allow for DML The opposite of “flash back” is “recover.” You cannot use Flashback Database in the following situations: –The control file has been restored or re-created. –A tablespace has been dropped. –A data file has been shrunk. Use the TO BEFORE RESETLOGS to flash back to before the last RESETLOGS operation.

6-25 Copyright © 2006, Oracle. All rights reserved. Flashback Database Considerations (notes only slide)

6-26 Copyright © 2006, Oracle. All rights reserved. Monitoring Flashback Database To monitor the ability to meet your retention target: View the flash recovery area disk quota: Determine the current flashback window: Monitor logging in the Flashback Database logs: SQL> SELECT estimated_flashback_size, 2 flashback_size 3 FROM V$FLASHBACK_DATABASE_LOG; SQL> SELECT * 2 FROM V$FLASHBACK_DATABASE_STAT; SQL> SELECT oldest_flashback_scn, 2 oldest_flashback_time 3 FROM V$FLASHBACK_DATABASE_LOG; Recycle bin Flashback DB Config. FB DB >Monitor FB DB Guar. Res. Pt.

6-27 Copyright © 2006, Oracle. All rights reserved.

6-28 Copyright © 2006, Oracle. All rights reserved. Monitoring Flashback Database with EM

6-29 Copyright © 2006, Oracle. All rights reserved. Guaranteed Restore Points A guaranteed restore point ensures that you can perform a FLASHBACK DATABASE command to that SCN at any time. SQL> CREATE RESTORE POINT before_load 2 GUARANTEE FLASHBACK DATABASE; Recycle bin Flashback DB Config. FB DB Monitor FB DB >Guar. Res. Pt.

6-30 Copyright © 2006, Oracle. All rights reserved. Summary In this lesson, you should have learned how to: Query the recycle bin Configure Flashback Database Perform Flashback Database to a point in time using Enterprise Manager or RMAN Monitor flashback log statistics Enable and disable the Flashback Database feature Use guaranteed restore points with Flashback Database

6-31 Copyright © 2006, Oracle. All rights reserved. Practice Overview: Performing Flashback Database This practice covers the following topics: Performing Flashback Database to undo unwanted transactions Monitoring the Flashback Database retention Determine the size of the flashback logs

6-32 Copyright © 2006, Oracle. All rights reserved.