Skip Headers
Oracle® Database Backup and Recovery Reference
10g Release 2 (10.2)

Part Number B14194-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

FLASHBACK

Syntax

flashback::=

Description of flashback.gif follows
Description of the illustration flashback.gif

Purpose

Performs a Flashback Database operation, returning the database to (or to just before) target time, as specified by time, SCN or log sequence number.

The result of using flashback database is generally similar to a database point-in-time recovery performed with RECOVER, except for the following principal differences:

Because FLASHBACK DATABASE does not require you to restore a backup, it is usually much faster than incomplete recovery.

Flashback Database also has a number of applications in the context of standby databases, including providing functionality comparable to storage snapshots for reporting and testing databases, more flexibility in testing disaster recovery, and recovery from unwanted changes at a standby such as application of corrupted or erroneous updates at the standby database. These uses are discussed in more detail in Oracle Data Guard Concepts and Administration.

Restrictions and Usage Notes

Table 2-3 How FLASHBACK Responds to Datafile Operations

If this datafile operation occurred during the flashback window ... Then the FLASHBACK command ...

Added

Removes the datafile record from the control file.

Dropped

Adds the datafile to the control file, but marks it as offline and does not flash it back. You can then restore and recover the datafile to the same time or SCN.

Renamed

Ignores the renaming. The datafile retains its current name.

Resized

May fail. You can take the datafile offline and then rerun the FLASHBACK command. The datafile will not be flashed back. You can then restore and recover the datafile to the same time or SCN.

Taken offline

Ignores the operation. The datafile retains its current online status.

Brought online

Ignores the operation. The datafile retains its current offline status.

Made read-only or read-write

Changes the status of the datafile in the control file.


Keywords and Parameters

Syntax Element Description
DEVICE TYPE deviceSpecifier Allocates automatic channels for the specified device type only. For example, if you configure automatic disk and tape channels, and issue FLASHBACK...DEVICE TYPE DISK, then RMAN allocates only disk channels. RMAN may need to restore redo logs from backup during the flashback database process. Changes between the last flashback log and the target time must be re-created based on the archived redo log. If no automatic channels are allocated for tape and a needed redo log is on tape, the FLASHBACK operation will fail.

See Also: "deviceSpecifier"

DATABASE Returns the database to the specified point. Query OLDEST_FLASHBACK_SCN and OLDEST_FLASHBACK_TIME in V$FLASHBACK_DATABASE_LOG to display the approximate lowest SCN and time to which you can flash back. View the current database SCN in V$DATABASE.CURRENT_SCN.
TO RESTORE POINT = ' restore_point_name Returns the database to the SCN associated with the specified restore point. This can be an ordinary restore point or a guaranteed restore point.
TO SCN = integer Returns the database to the point up to (and including) the specified SCN. By default, the provided SCN resolves to the current or ancestor incarnation. The DBA can override the default by using the RMAN RESET DATABASE INCARNATION command to set the recovery target incarnation.
TO BEFORE SCN = integer Returns the database to its state just before the specified SCN. Any changes at an SCN lower than that specified are applied, but if there is a change associated with the specified SCN it is not applied. By default, the provided SCN resolves to the current or ancestor incarnation. The DBA can override the default by using the RMAN RESET DATABASE INCARNATIONcommand to set the recovery target incarnation.
TO SEQUENCE = integer THREAD = integer Specifies a redo log sequence number and thread as an upper limit. RMAN applies changes up to (and including) the last change in the log with the specified sequence and thread number.
TO BEFORE SEQUENCE = integer [THREAD = integer] Specifies a redo log sequence number and thread as an upper limit. RMAN applies changes up to (but not including) the last change in the log with the specified sequence and thread number.
TO TIME = 'date_string' Returns the database to its state at the specified time. You can use any SQL DATE expressions to convert the time to the current format, for example, FLASHBACK DATABASE UNTIL TIME 'SYSDATE-7'.
TO BEFORE TIME = 'date_string' Similar to the TO TIME clause, but returns the database to its state including all changes up to but not including changes at the specified time.
TO BEFORE RESETLOGS Returns the database to its state including all changes up to the SCN of the lastOPEN RESETLOGS.

Examples

FLASHBACK DATABASE to a Specific SCN: Example The following command uses Flashback Database to return the database to the specified SCN:

RMAN> FLASHBACK DATABASE TO SCN 46963;

FLASHBACK DATABASE to One Hour Ago: Example The following command uses Flashback Database to return the database to 1/24 of a day (one hour) in the past:

RMAN> FLASHBACK DATABASE TO TIMESTAMP (SYSDATE-1/24);

FLASHBACK DATABASE to a Specific Time: Example The following command uses SQL date conversion functions to specify the target time:

RMAN> FLASHBACK DATABASE TO TIMESTAMP
   TO_TIMESTAMP('2002-03-11 16:00:00', 'YYYY-MM-DD HH24:MI:SS');

FLASHBACK DATABASE to a Restore Point: Example The following command uses a restore point to identify the target time for a Flashback Database operation:

RMAN> FLASHBACK DATABASE TO RESTORE POINT "before_batch";

FLASHBACK DATABASE to Before the Last Resetlogs: Example The following command returns the database to immediately before the most recent OPEN RESETLOGS:

RMAN> FLASHBACK DATABASE TO BEFORE RESETLOGS;