Maine Finance

Aug 26 2017

Recover Database until cancel tips #oracle #recover #database #until #time, #recover #database #until #cancel #tips


#

Recover Database until cancel tips

Problem: How do I recover until cancel with Oracle when doing a roll forward?

Can someone explain why it is necessary to perform recover database until cancel before using alter database open resetlogs when you are restoring a cold backup without a backup of the redo log files.

I perform the following steps, which I thought would be very simple, however I get an error on opening the database.

Restore all backup datafiles and controlfiles (OS copy)

ALTER DATABASE OPEN RESETLOGS

ORA-01139: RESETLOGS option only valid after an incomplete database recovery

So I tried using:

RECOVER DATABASE UNTIL CANCEL

ALTER DATABASE OPEN RESETLOGS

And this works, the database is opened and the new redo logs are created.

I got a trace of my controlfile and found the following..

CREATE CONTROLFILE REUSE DATABASE TEST NORESETLOGS NOARCHIVEMODE.

I think it is no NORESETLOGS that is causing the problem as if I re-create the control file with RESETLOGS specified it works fine.


Solution:
The Oracle documentation notes:

In cancel-based recovery, recovery proceeds by prompting you with the suggested filenames of archived redo log files. Recovery stops when you specify CANCEL instead of a filename or when all redo has been applied to the datafiles.

Cancel-based recovery is better than change-based or time-based recovery if you want to control which archived log terminates recovery. For example, you may know that you have lost all logs past sequence 1234, so you want to cancel recovery after log 1233 is applied.

You should perform cancel-based media recovery in these stages:

  1. Prepare for recovery by backing up the database and correct any media failures as described in Preparing for Incomplete Recovery .
  2. Restore backup datafiles as described in Restoring Datafiles Before Performing Incomplete Recovery . If you have a current control file, then do not restore a backup control file.
  3. Perform media recovery on the restored database backup as described in the following procedure.

To perform cancel-based recovery:

  1. Start SQL*Plus and connect to Oracle with administrator privileges. For example, enter:
  • Start a new instance and mount the database:
  • Begin cancel-based recovery by issuing the following command:

    RECOVER DATABASE UNTIL CANCEL

    If you are using a backup control file with this incomplete recovery, then specify the USING BACKUP CONTROLFILE option in the RECOVER command.

    RECOVER DATABASE UNTIL CANCEL USING BACKUP CONTROLFILE

    If you fail to specify the UNTIL clause on the RECOVER command, then you will not be able to open the database until a complete recovery is done.

    1. Oracle applies the necessary redo log files to reconstruct the restored datafiles. Oracle supplies the name it expects to find from LOG_ARCHIVE_DEST_1 and requests you to stop or proceed with applying the log file. Note that if the control file is a backup, then you must supply the names of the online logs if you want to apply the changes in these logs.

    If you use an Oracle Real Application Clusters configuration, and you are performing incomplete recovery or using a backup control file, then Oracle can only compute the name of the first archived redo log file from the first thread. The first redo log file from the other threads must be supplied by the user. After the first log file in a given thread has been supplied, Oracle can suggest the names of the subsequent log files in this thread.

    1. Continue applying redo log files until the last log has been applied to the restored datafiles, then cancel recovery by executing the following command:

    Oracle returns a message indicating whether recovery is successful. Note that if you cancel recovery before all the datafiles have been recovered to a consistent SCN and then try to open the database, you will get an ORA-1113 error if more recovery is necessary for the file. You can query V$RECOVER_FILE to determine whether more recovery is needed, or if a backup of a datafile was not restored prior to starting incomplete recovery.

    1. Open the database in RESETLOGS mode. You must always reset the online logs after incomplete recovery or recovery with a backup control file. For example, enter:

    For more information on Oracle OPEN RESETLOGS, go HERE .

    Burleson is the American Team

    Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals. Feel free to ask questions on our Oracle forum .

    Verifyexperience!Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications .

    Errata? Oracle technology is changing and we strive to update our BC Oracle support information. If you find an error or have a suggestion for improving our content, we would appreciate your feedback. Just e-mail: and include the URL for the page.


    The Oracle of Database Support

    Copyright 1996 – 2016

    All rights reserved by Burleson

    Oracle is the registered trademark of Oracle Corporation.



    Written by admin


    Leave a Reply

    Your email address will not be published. Required fields are marked *