Label

Friday, June 22, 2012

Restore database upto a certain time/SCN/SEQUENCE--- Incomplete recovery.

 SQL> startup force mount

Logon to RMAN prompt.

run {
set until time "to_date('30/02/2012 14:25:00','DD/MM/YYYY HH24:MI:SS')";
#set until scn 1557560;      # Database would be recovered to SCN 1557559
#set until sequence 9923;   # Database would be recovered to SEQUENCE 9922
restore database;
recover database;
alter database open resetlogs;
}

Explanation of steps ---

startup force mount - It is mandatory to have a database in mount stage to perform a recovery of whole database.
set until time "to_date(30/02/2012 14:25:00','DD/MM/YYYY HH24:MI:SS')";
set until scn 1557560;
set until sequence 9923;

 whenever we use to perform incomplete recovery to a particular SCN or sequence, the database is always recovered to mentioned SCN-1 or SEQUENCE-1 same is the case with time.

eg..
run{
set until scn 1557560;
restore database;
recover database;
alter database open resetlogs;
}

Here the database would be recovered upto SCN 1557559 same happens with the sequence and with the time.

restore database; - This command is issued to replace the corrupt or damaged files from having a good backup piece or a backup copy.
recover database; - This command is issued to apply the archived or redo logs.
alter database open resetlogs; - This is issued whenever we have an incomplete recovery as it creates a new logical life of a database means a new incarnation. To get list of it enter list incarnation; on rman prompt.

No comments:

Post a Comment