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

Steps to recover the 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 datafile 12.

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

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

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

On primary database

3) Place the datafile to recover offline.

SQL> alter database datafile 12 offline;

4) catalog this datafile copy:

RMAN> catalog datafilecopy '/tmp/df12.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/df12.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/df12.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;

3 comments:

  1. Thanks for this kind of documents. They are simply very much useful for the DBAs like us.Because of this we can crack any interview easily.personally thx tonnnnn!!!!

    ReplyDelete
  2. I am trying the second option here which is restoring to standby database, but getting this erron on restore

    restore datafile 5;

    Starting restore at 10-MAY-13
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=473 device type=DISK
    allocated channel: ORA_DISK_2
    channel ORA_DISK_2: SID=556 device type=DISK
    allocated channel: ORA_DISK_3
    channel ORA_DISK_3: SID=6 device type=DISK
    allocated channel: ORA_DISK_4
    channel ORA_DISK_4: SID=84 device type=DISK

    channel ORA_DISK_1: starting datafile backup set restore
    channel ORA_DISK_1: specifying datafile(s) to restore from backup set
    channel ORA_DISK_1: restoring datafile 00005 to +DATA/prmrgsb1/datafile/data_800
    00k_04.396.797340199
    channel ORA_DISK_1: reading from backup piece X:\RMAN_TEMP\DF5_PR.BCK
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of restore command at 05/10/2013 15:37:51
    ORA-19870: error while restoring backup piece X:\RMAN_TEMP\DF5_PR.BCK
    for datafile 5

    ReplyDelete
  3. Check the permission of the file

    ReplyDelete