Oct 25, 2012

DATABASE POINT IN TIME RECOVERY


To recover the database to a point(SCN/timestamp/sequence) before error has occured.

Prerequisites:
==============

1) Find the SCN or timestamp
-------------------------
In case we have to find the exact time when the last database object was imported

SQl> SELECT OBJECT_NAME,TIMESTAMP FROM DBA_OBJECTS WHERE TIMESTAMP=(SELECT MAX(TIMESTAMP) FROM DBA_OBJECTS WHERE OWNER='SCOTT');

once we get the <<object_name>> we have to find the SCN of the last row inserted.

select max(ora_rowscn) from <<object_name>>;

make a note of this SCN

2) Database should be in Archivelog Mode
3) Make sure the latest database backup before SCN is available
4) Make sure all the archivelogs are available between the backup and target SCN

Procedure:
==========
1) Shutdown the database ex: Shut immediate
2) Mount the database ex: startup mount
3) connect to rman ex: rman target /
4) rman> RUN
{
  SET UNTIL SCN <<SCN NO>>;  
  RESTORE DATABASE;
  RECOVER DATABASE;
}

5) CONNECT TO SQLPLUS ex: !sq
6) SQL> alter database open resetlogs;






No comments:

Post a Comment