Incomplete Recovery   «Prev  Next»

Performing Cancel-Based Recovery

The steps in the simulation are as follows:
  1. Before you start the recovery process, you decide to perform a whole closed database backup. At the prompt, type SHUTDOWN IMMEDIATE to shutdown the database. When you finish, press Enter.
  2. To perform a backup using the operating system, type HOST at the prompt. After you finish, press Enter.
  3. Suppose you have a batch file, do_backup.bat, that will perform the backup. This file is stored at the present directory. To have the file perform the backup, type DO_BACKUP at the prompt. After you finish, press Enter.
  4. Now you are going to restore all the datafiles. Remember all the database files must be older than the lost archived log #448, but the control file must be current. Suppose you have another batch file to restore all the datafiles for you. This file is called do_dbf_restore.bat. To perform this operation, type DO_DBF_RESTORE at the prompt. After you finish, press Enter.
  5. Now you want to make sure the restoring of the datafiles has been done correctly. Type DIR at the prompt. After you finish, press Enter.
  6. After reading the timestamp for each datafile (see the highlighted text) you are sure that you have restored the correct datafiles since these are older than the lost archived log #448. To go back to Server Manager, type SVMGR30 at the prompt. After you finish, press Enter.
  7. Now you have to perform the recovery of the database in the mount mode. To mount the database, type STARTUP MOUNT at the prompt. After you finish, press Enter.
  8. The database is mounted and you are ready to perform a cancel-based recovery. Type RECOVER DATABASE UNTIL CANCEL at the prompt. After you finish, press Enter.
  9. When Oracle prompts you with the suggestion to apply a certain archived log, you must press enter in order to continue. This step is repeated for each archived log that needs to be applied. This Simulation will skip all these repetitions and move right to the archived log you want to apply. Press Enter when you are ready to move on.
  10. Now you have reached archived log #448. Since this log is lost, the recovery cannot pass this log. To move on to the next step in the recovery process, type CANCEL at the prompt. After you finish, press Enter.
  11. To synchronize the recovered datafiles with the control file and redo log files and open the database, type ALTER DATABASE OPEN RESET LOGS; at the prompt. After you finish, press Enter.
  12. You have successfully recovered the database using the cancel-based recovery. Do not forget to make another whole database backup to avoid this type of recovery. This is the end of the Simulation.

Oracle RMAN Backup and Recovery

Performing Cancel-Based Incomplete 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:
  1. Follow Step1 through Step 8 in "Performing Closed Database Recovery"
  2. 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.
  3. 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.
  4. 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.
  5. 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