Thursday, November 12, 2009

How to restore a database to Point in Time using RMAN

You can recover whole database to a specific SCN, time or log sequence number using RMAN, this is called incomplete recovery or point-in-time Recovery (DBPITR).

You must restore all data files from backups create prior to the time to which you want to recovery and you must open database with RESETLOGS option when completes. Please note that RESETLOGS operation creates a new incarnation of the database.

Usually incomplete recovery will be performed under following situations:
1. Corrupt or destroy of some or all online redo logs due to media failure
2. User error causes data loss, for ex accidental drop of a table
3. Archive log missing and you cannot able to perform incomplete recovery
4. Loss of current control file and must use a backup control file to open database.



Follow the steps to recover the database until a specified SCN, time or log sequence

Step 1: Shutdown and startup mount
SQL> SHUTDOWN IMMEDAITE;
SQL> STARTUP MOUNT;

Step 2: Determine the SCN, time or log sequence that you want to recovery the
SCN – you can get the SCN from alert.log file
Sequence – v$log_history

3. Perform the incomplete recovery
If specifying a time, then set NLS_LANG and NLS_DATE_FORMAT environment variables.

RUN
{
SET UNTIL TIME 'Aug 10 2009 11:00:00';
# SET UNTIL SCN 100; # alternatively, specify SCN
# SET UNTIL SEQUENCE 123; # alternatively, specify log seq
RESTORE DATABASE;
RECOVER DATABASE;
}

4. Open database with resetlogs
SQL> ALTER DATABASE OPEN RESETLOGS;

Regards,
Satishbabu Gunukula
http://www.oracleracexpert.com/

6 comments:

  1. Simple, direct and straight to the point. Well done, Sir!

    ReplyDelete
  2. This website of yours is really helpful it provided us with massive valuable information to work on there are many impressive post that you have done in this site which we found it as treasure in details please keep his excellent and delight job in further updates thank you very much indeed Read more

    ReplyDelete