This module discussed some basic concepts about performing incomplete recovery to an ARCHIVELOG database. You learned about different
situations in which incomplete recovery must be applied, different types of incomplete recovery, and how to handle recovery in different
situations. Having completed this module, you should be able to
- Identify an incomplete recovery situation
- List incomplete database recovery steps
- Monitor recovery progress information using the alert log
- Perform a time-based recovery
- Perform a cancel-based recovery
- Use a backup control file to recover
- Recover without the current redo log
- Handle recovery through RESETLOGS
- Perform tablespace point-in-time recovery
In cancel-based recovery, recovery proceeds by prompting you with the suggested file names of archived redo log files. Recovery stops when you specify CANCEL instead of a file name or when all redo has been applied to the data files.
To perform cancel-based recovery:
- Follow Step1 through Step 8 in "Performing Closed Database Recovery"
- Begin cancel-based recovery by issuing the following command in SQL*Plus:
RECOVER DATABASE UNTIL CANCEL
Note: If you fail to specify the UNTIL clause on the RECOVER command, then the database assumes a complete recovery and does not open until all redo is applied.
The database applies the necessary redo log files to reconstruct the restored data files. The database supplies the name it expects to find from LOG_ARCHIVE_DEST_1 and requests you to stop or proceed with applying the log file.
If the control file is a backup, then you must supply the names of the online redo logs if you want to apply the changes in these logs.
- Continue applying redo log files until the last log has been applied to the restored data files, then cancel recovery by executing the following command:
CANCEL
The database indicates whether recovery is successful. If you cancel before all the data files have been recovered to a consistent SCN and then try to open the database, then you get an ORA-1113 error if more recovery is necessary. You can query V$RECOVER_FILE to determine whether more recovery is needed, or if a backup of a data file was not restored before starting incomplete recovery.
-
Open the database with the RESETLOGS option.
You must always reset the logs after incomplete recovery or recovery with a backup control file. For example:
ALTER DATABASE OPEN RESETLOGS;
If you attempt to use OPEN RESETLOGS when you should not, or if you neglect to reset the log when you should, then the database returns an error and does not open the database. Correct the problem and try again.
-
After opening the database with the RESETLOGS option, check the alert log.
Note: The easiest way to locate trace files and the alert log is to run the following SQL query:
SELECT NAME, VALUE FROM V$DIAG_INFO.
When you open with the RESETLOGS option, the database returns different messages depending on whether recovery was complete or incomplete.
If the recovery was complete, then the following message appears in the alert log:
RESETLOGS after complete recovery through change scn
If the recovery was incomplete, then this message is reported in the alert log, where scn refers to the end point of incomplete recovery:
RESETLOGS after incomplete recovery UNTIL CHANGE scn
The next module shows you how to maintain redo log files and introduces recovery situations that occur only infrequently.
This module introduced you to the following terms:
- Incomplete recovery: Incomplete recovery reconstructs the database as it was at a specified time before the media failure.
- Mirror online redo logs: Make frequent backups and duplex the archived log files.
- Time-based recovery: To perform a time-based recovery, you must specify a point-in-time in the process. The recovery is complete when that specified point-in-time is reached.
- Cancel-based recovery: A cancel-based recovery is performed by entering CANCEL (instead of a log file name or AUTO) at the recovery prompt.
- Change-based recovery: To perform a change-based recovery, you terminate the recovery at a specified system change number (SCN). This approach is often applied when you recover a database in a distributed environment.
- Alert log file: The alert log file is a special trace file for a database. It chronologically records messages and errors about database operations, such as internal errors, block corruption errors, and information about administration operations,
including database recovery.
- Tablespace point-in-time recovery (TSPITR): Tablespace point-in-time recovery (frequently abbreviated as TSPITR) refers to a recovery of all datafiles in a tablespace to a specific time.
The following section discuss how to perform a cancel-based recovery.