Download presentation
Presentation is loading. Please wait.
Published byGiles Russell Modified over 9 years ago
1
9 Copyright © 2004, Oracle. All rights reserved. Flashback Database
2
9-2 Copyright © 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to: Describe Flashback Database architecture Enable and disable the Flashback Database Monitor the Flashback Database Use the Enterprise Manager Recovery Wizard
3
9-3 Copyright © 2004, Oracle. All rights reserved. Flashback Any Error Flashback Database brings the database to a prior 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 restoring a backup. Flashback Drop restores accidentally dropped tables.
4
9-4 Copyright © 2004, Oracle. All rights reserved. Flashback Technology Benefits Flashback technology is a revolutionary advance in recovery Traditional recovery techniques are slow –Entire database or file has to be restored, 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 multi-step procedures
5
9-5 Copyright © 2004, Oracle. All rights reserved. When to Use Flashback Technology Object Level ScenarioFlashback Technology DatabaseDrop UserFlashback Database Truncate TableFlashback Database Batch job: partial changesFlashback Database TableDrop TableFlashback Drop Update with wrong WHERE clause Flashback Table Comparing current data against the data at some time in the past Flashback Query TxBatch Job runs twice, but not really sure of the objects affected Flashback Query
6
9-6 Copyright © 2004, 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. Corrupted database Database is "rewound" Press the rewind button Users generate errors
7
9-7 Copyright © 2004, Oracle. All rights reserved. Flashback Database Reduces 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
8
9-8 Copyright © 2004, Oracle. All rights reserved. Flashback Database Architecture Flashback Buffer Redo Log Buffer SGA LGWR RVWR 8Mb16Mb Flashback Logs Redo Logs …… Buffer Cache Write direction Apply direction 1 Log block before images periodically Back out changes to database without restore Forward media recovery Every change Not every change! 2
9
9-9 Copyright © 2004, Oracle. All rights reserved. Configuring Flashback Database 1. Configure the flash recovery area 3. Enable Flashback Database 2. Set the retention target SQL> ALTER DATABASE FLASHBACK ON; SQL>ALTER SYSTEM SET 2DB_FLASHBACK_RETENTION_TARGET=2880 3SCOPE=BOTH;
10
9-10 Copyright © 2004, Oracle. All rights reserved. Configure Flashback Database with EM Make sure the database is in ARCHIVELOG mode.
11
9-11 Copyright © 2004, Oracle. All rights reserved. Configure Flashback Database with EM Enable Flashback logging and specify flash recovery area
12
9-12 Copyright © 2004, Oracle. All rights reserved. Monitoring Flashback Database Adjust 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;
13
9-13 Copyright © 2004, Oracle. All rights reserved.
14
9-14 Copyright © 2004, Oracle. All rights reserved. Monitoring Flashback Database with EM
15
9-15 Copyright © 2004, Oracle. All rights reserved. Monitoring Flash Recovery Area with EM
16
9-16 Copyright © 2004, Oracle. All rights reserved. Best Practices for the Database and Flash Recovery Area Use the flash recovery area for recovery-related files: Simplifies location of database backups Automatically manages the disk space allocated for recovery files Does not require changes to existing scripts Puts database backups, archive logs, and control file backups in the flash recovery area
17
9-17 Copyright © 2004, Oracle. All rights reserved. Backing Up the Flash Recovery Area RMAN> BACKUP RECOVERY FILES;
18
9-18 Copyright © 2004, Oracle. All rights reserved. Flash Recovery Area Space Usage Configure the retention policy to the minimum value appropriate for your database Backup the archive log files regularly and delete the files upon completion of the backup Use the RMAN REPORT OBSOLETE and DELETE OBSOLETE commands to remove unneeded backups and file copies
19
9-19 Copyright © 2004, Oracle. All rights reserved. Flashback Database Examples RMAN> FLASHBACK DATABASE TO TIME = 2> TO_DATE('2004-05-27 16: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;
20
9-20 Copyright © 2004, Oracle. All rights reserved. Flashback Database with EM Select object and operation type
21
9-21 Copyright © 2004, Oracle. All rights reserved. Flashback Database with EM Launching Recovery Wizard
22
9-22 Copyright © 2004, Oracle. All rights reserved. Flashback Database Using EM
23
9-23 Copyright © 2004, 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 tablespace_name, flashback_on 2 FROM v$tablespace;
24
9-24 Copyright © 2004, 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 updates The opposite of flashback 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. –You want to flashback before RESETLOGS operation.
25
9-25 Copyright © 2004, Oracle. All rights reserved. Summary In this lesson, you should have learned how to: Describe Flashback Database architecture Enable and disable Flashback Database Monitor Flashback Database Use the Enterprise Manager Recovery Wizard
26
9-26 Copyright © 2004, Oracle. All rights reserved. Practice 9 Overview: Flashback Database These practices cover the following topics: Configuration of Flashback Database Using the Flashback Database RMAN interface Using Flashback Database through the EM Database Control Console Managing and monitoring Flashback Database operations
27
9-27 Copyright © 2004, Oracle. All rights reserved.
28
9-28 Copyright © 2004, Oracle. All rights reserved.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.