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

Slides:



Advertisements
Similar presentations
18 Copyright © Oracle Corporation, All rights reserved. Transporting Data Between Databases.
Advertisements

5 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
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.
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
Using RMAN to Perform Recovery
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.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
15 Copyright © 2005, Oracle. All rights reserved. Performing Database Backups.
1 Oracle Database 11g – Flashback Data Archive. 2 Data History and Retention Data retention and change control requirements are growing Regulatory oversight.
16 Copyright © 2007, Oracle. All rights reserved. Performing Database Recovery.
4 Copyright © 2006, Oracle. All rights reserved. Recovering from Noncritical Losses.
9 Copyright © 2004, Oracle. All rights reserved. Flashback Database.
The protection of the DB against intentional or unintentional threats using computer-based or non- computer-based controls. Database Security – Part 2.
Backup and Recovery Overview Supinfo Oracle Lab. 6.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
17 Copyright © Oracle Corporation, All rights reserved. Recovery Catalog Creation and Maintenance.
Oracle Database 10 g Time Navigation: Human-Error Correction Magnus Lubeck DBA/Systems Analyst CERN, IT-DB Group Session id: Tammy Bednar Sr. Product.
7 Copyright © 2004, Oracle. All rights reserved. Recovering from Noncritical Losses.
6 Copyright © 2006, Oracle. All rights reserved. Flashback.
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.
13 Copyright © Oracle Corporation, All rights reserved. Maintaining Data Integrity.
© 2006 Northgate Information Solutions plc and its associated companies. All rights reserved. Slide 1.
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.
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.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
11 Copyright © 2007, Oracle. All rights reserved. Using Flashback Technology.
6 Copyright © Oracle Corporation, All rights reserved. Backup and Recovery Overview.
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.
2 Copyright © 2009, Oracle. All rights reserved. Managing Schema Objects.
11 Copyright © 2009, Oracle. All rights reserved. Enhancing ETL Performance.
9 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
10 Copyright © 2007, Oracle. All rights reserved. Managing Undo Data.
Oracle Database High Availability
Controlling User Access
Recovery Catalog Creation and Maintenance
Performing Flashback.
Recovering from User Errors
Oracle Database High Availability
Performing Tablespace Point-in-Time Recovery
Performing Tablespace Point-in-Time Recovery
Using Flashback Technology I
Index Index.
Managing Privileges.
Performing Database Recovery
Oracle 12R2 Database Flashback Technologies
Presentation transcript:

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

17-2 Copyright © 2005, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to: Describe Flashback Database Restore the table content to a specific point in the past with Flashback Table Recover from a dropped table View the contents of the database as of any single point in time with Flashback Query See versions of a row over time with Flashback Versions Query View transaction history or a row with Flashback Transaction Query

17-3 Copyright © 2005, Oracle. All rights reserved. Flashback Technology: Benefits The Flashback technology is a revolutionary advance in recovery. Traditional recovery techniques are slow: –The entire database or a file has to be restored, and not just the incorrect data. –Every change in the database log must be examined. Flashback is fast: –Changes are indexed by row and by transaction. –Only the changed data is restored. Flashback commands are easy: –No complex multiple-step procedures are involved. >Overview Database Table Drop Query Versions Transaction

17-4 Copyright © 2005, Oracle. All rights reserved. When to Use the Flashback Technology 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

17-5 Copyright © 2005, Oracle. All rights reserved. Flashing Back Any Error Flashback Database brings the database to an earlier point in time by undoing all changes made since that time. Flashback Table recovers a table to a point in time in the past without having to restore from a backup. Flashback Drop restores accidentally dropped tables.

17-6 Copyright © 2005, Oracle. All rights reserved. Flashback Database: Overview 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.” Press the rewind button. Users generate errors. Overview >Database Table Drop Query Versions Transaction

17-7 Copyright © 2005, Oracle. All rights reserved. Flashback Database: Reducing Restore Time Backup User error Apply logs forward Restore files Generate logs Repaired database Incomplete Recovery Backup User error Apply Flashback logs backward Flashback logs Repaired database Flashback Database

17-8 Copyright © 2005, Oracle. All rights reserved. Flashback Database: Considerations When the Flashback Database operation completes, the database must be opened by using one of these methods: –In read-only mode to verify that the correct target time or SCN has been used –With the RESETLOGS parameter to allow for updates The opposite of flash back is recover.

17-9 Copyright © 2005, Oracle. All rights reserved. Flashback Database: Limitations 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. PresentFlashback target time Drop tablespace Shrink data file Re-create control file

17-10 Copyright © 2005, Oracle. All rights reserved. Enabling Flashback Database

17-11 Copyright © 2005, Oracle. All rights reserved. Flashback Table: Overview Flashback Table recovers tables to a specific point in time. Flashback Table is an in-place operation. The database stays online. User Erroneous DMLs Flashed back tables Overview Database >Table Drop Query Versions Transaction

17-12 Copyright © 2005, Oracle. All rights reserved. Flashback Table Using Flashback Table, you can recover a table or tables to a specific point in time without restoring a backup. Data is retrieved from the undo tablespace to perform a Flashback Table operation. The FLASHBACK TABLE privilege is required to perform flashback of a table. Row movement must be enabled on the table that you are performing the flashback operation on.

17-13 Copyright © 2005, Oracle. All rights reserved. Enabling Row Movement on a Table ALTER TABLE employees ENABLE ROW MOVEMENT;

17-14 Copyright © 2005, Oracle. All rights reserved. Performing Flashback Table FLASHBACK TABLE hr.employees TO TIMESTAMP TO_TIMESTAMP(' :32:00', 'YYYY-MM-DD HH24:MI:SS');

17-15 Copyright © 2005, Oracle. All rights reserved. Performing Flashback Table Notes Only Page

17-16 Copyright © 2005, Oracle. All rights reserved. Flashback Table: Considerations The FLASHBACK TABLE command executes as a single transaction, acquiring exclusive DML locks. Statistics are not flashed back. Current indexes and dependent objects are maintained. Flashback Table operations: –Cannot be performed on system tables –Cannot span DDL operations –Are written to the alert log file –Generate undo and redo data

17-17 Copyright © 2005, Oracle. All rights reserved. Flashback Drop: Overview DROP TABLE employees; FLASHBACK TABLE employees TO BEFORE DROP; Mistake was made Recycle Bin Overview Database Table >Drop Query Versions Transaction

17-18 Copyright © 2005, Oracle. All rights reserved. Flashing Back Dropped Tables Through Enterprise Manager Dependent bitmap index will also be flashed back.

17-19 Copyright © 2005, Oracle. All rights reserved. Flashback Drop: Considerations Flashback Drop does not work for tables that: –Reside in the SYSTEM tablespace –Use fine-grained auditing or Virtual Private Database –Reside in a dictionary managed tablespace –Have been purged, either by manual purging or automatic purging under space pressure The following dependencies are not protected: –Bitmap-join indexes –Materialized view logs –Referential integrity constraints –Indexes dropped before tables

17-20 Copyright © 2005, Oracle. All rights reserved. Flashback Time Navigation Flashback Query: –Query all data at a specified point in time. Flashback Versions Query: –See all versions of a row between two times. –See the transactions that changed the row. Flashback Transaction Query: –See all changes made by a transaction. Tx3 Tx1 Tx2 Time Flashback Overview Database Table Drop >Query Versions Transaction

17-21 Copyright © 2005, Oracle. All rights reserved. Flashback Query: Overview t1t2 SELECT employee_id, salary FROM employees AS OF TIMESTAMP t1 WHERE employee_id = 200 Employees Unwanted updates

17-22 Copyright © 2005, Oracle. All rights reserved. Flashback Query: Example 11:0011:10 UPDATE employees SET salary = (SELECT salary FROM employees AS OF TIMESTAMP TO_TIMESTAMP (' :00:00', 'yyyy-mm-dd hh24:mi:ss') WHERE employee_id = 200) WHERE employee_id = 200 Employees salary = 4400 Employees salary = 4400 salary = 4840

17-23 Copyright © 2005, Oracle. All rights reserved. Flashback Versions Query: Overview t1 t2 Tx1Tx1Tx2Tx2 SELECT versions_xid, salary FROM employees VERSIONS BETWEEN TIMESTAMP t1 and t2 WHERE employee_id = 200; Tx0Tx0 Tx0Tx0Tx1Tx1Tx2Tx2 Employees 200 Overview Database Table Drop Query >Versions Transaction

17-24 Copyright © 2005, Oracle. All rights reserved. Flashback Versions Query Through Enterprise Manager

17-25 Copyright © 2005, Oracle. All rights reserved. Flashback Versions Query: Considerations The VERSIONS clause cannot be used to query: –External tables –Temporary tables –Fixed tables –Views The VERSIONS clause cannot span DDL commands. Segment shrink operations are filtered out.

17-26 Copyright © 2005, Oracle. All rights reserved. Flashback Transaction Query: Overview Undo SQL FLASHBACK_TRANSACTION_QUERY DBA User Erroneous DML Overview Database Table Drop Query Versions >Transaction

17-27 Copyright © 2005, Oracle. All rights reserved. Flashback Transaction Query Through Enterprise Manager

17-28 Copyright © 2005, Oracle. All rights reserved. Flashback Transaction Query: Considerations DDLs are seen as dictionary updates. Dropped objects appear as object numbers. Dropped users appear as user identifiers.

17-29 Copyright © 2005, Oracle. All rights reserved. Summary In this lesson, you should have learned how to: Describe Flashback Database Restore the table content to a specific point in the past with Flashback Table Recover from a dropped table View the contents of the database as of any single point in time with Flashback Query See versions of a row over time with Flashback Versions Query View transaction history or a row with Flashback Transaction Query

17-30 Copyright © 2005, Oracle. All rights reserved. Practice Overview: Using Flashback This practice covers the following topics: Using Flashback to recover a dropped table Performing Flashback Versions Query