Sunday, November 17, 2013

Steps to recover the primary database's datafile using a copy of a standby database's datafile

Steps to recover the Dataguard primary database's datafile using a copy of a standby database's datafile.

This procedure will work for all file systems including raw or ASM.


Through this example we will be using user12 (datafile).

1) On standby database, copy datafile from ASM to a file system:

SQL> select NAME,FILE#,TS# from v$datafile;

RMANbackup as copy datafile 12 format '/tmp/user12.dbf';

2) Move the datafile copy from standby to primary database host using scp.

3)On primary database Place the datafile to recover offline.


SQL> alter database datafile 12 offline;

4) catalog this datafile copy:

RMAN> catalog datafilecopy '/tmp/user5.dbf';

5) Confirm that datafile exists:

RMAN> list copy of datafile 12;

6) Restore the datafile:

RMAN> restore datafile 12;

7) Recover the datafile:

RMAN> recover datafile 12;

8) Place the datafile online:

SQL> alter database datafile 12 online;



Steps to recover the standby database's datafile using a copy of a primary database's datafile.

1) Backup the primary database's datafile.

RMAN> backup as copy datafile 12 format '/tmp/user5.dbf';

2) transfer the file to the standby site using an operating system utility such as scp.

3) catalog the datafile copy on the standby site.

RMAN> catalog datafilecopy '/tmp/user5.dbf';

4) stop redo apply on the physical standby database.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

5) on the standby site restore the datafile copy.

RMAN> restore datafile 12;

6) restart redo apply on the physical standby database.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

No comments:

Post a Comment