Databases Reference
In-Depth Information
Performing Log Sequence-Based Recovery
Problem
You want to use RMAN to restore up to, but not including, a certain archived redo log file.
Solution
RMAN allows you to apply redo up to (but not including) a specific archived redo log file by specifying its sequence
number when restoring and recovering. You can do this in one of two ways:
until sequence
as part of the
restore
and
recover
commands.
•
Specify
set until sequence
command.
•
Use the
The following example restores and recovers the target database up to, but not including, log sequence number 5:
$ rman target /
RMAN> startup mount;
RMAN> restore database until sequence 5;
RMAN> recover database until sequence 5;
RMAN> alter database open resetlogs;
If everything went well, you should now see output similar to this:
Statement processed
You can also use the
set until
command from within a
run{}
block to perform a log sequence-based recovery.
The following examples restores and recovers up to but not including log sequence number 5 of thread 1:
$ rman target /
RMAN> startup mount;
RMAN> run{
set until sequence 5 thread 1;
restore database;
recover database;
}
RMAN> alter database open resetlogs;
If everything went well, you should now see output similar to this:
Statement processed
How It Works
Usually log sequence-based incomplete database recovery is initiated because you have a missing or damaged
archived redo log file. If that's the case, you can recover only up to your last good archived redo log file, because you
cannot skip a missing archived redo log file.