Usually this type of incomplete database recovery is initiated because you have a missing or damaged archivelog file. If that is the case, you can recover only up to your last good archivelog file, because you cannot skip a missing archivelog.
How you determine which archivelog file to restore up to (but not including) will vary.
For example, if you are physically missing an archivelog file and RMAN cannot find it in a backup set, you will receive a message such as this when trying to apply the missing file:
RMAN-06053: unable to perform media recovery because of missing log RMAN-06025: no backup of archived log for thread 1 with sequence 19…
Based on the previous error message, you would restore up to (but not including) log sequence 19.
$ rman target / RMAN> startup mount;
RMAN> restore database until sequence 19; RMAN> recover database until sequence 19; RMAN> alter database open resetlogs;
If successful, you should see output such as this:
Statement processed
Performing SCN-Based Recovery
SCN-based incomplete database recovery works in situations in which you know the SCN value at which you want to end the restore-and-recovery session. RMAN will recover up to, but not including, the specified SCN. RMAN automatically terminates the restore process when it reaches the specified SCN.
You can view your database SCN information in several ways:
• Using LogMiner to determine an SCN associated with a DDL or DML statement
• Looking in the alert.log file
• Looking in your trace files
• Querying the FIRST_CHANGE# column of V$LOG, V$LOG_HISTORY, and V$ARCHIVED_LOG
After establishing the SCN to which you want to restore, use the UNTIL SCN clause to restore up to, but not including, the SCN specified. The following example restores all transactions that have an SCN that is less than 95019865425:
$ rman target / RMAN> startup mount;
RMAN> restore database until scn 95019865425; RMAN> recover database until scn 95019865425; RMAN> alter database open resetlogs;
If everything goes well, you should see output such as this:
Statement processed