How to Copy Datafile from Primary to Standby Database using RMAN

Steps to copy the datafile from the primary database to the standby database using RMAN.

1. From the Primary DB server, run:

rman target=/

RMAN> backup as copy datafile 324 format ‘/home/oracle/backup_standby/test_xmit.dbf';

Starting backup at 04-FEB-15
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
channel ORA_DISK_1: starting datafile copy
input datafile file number=00324 name=/u06/app/oracle/oradata/SERVER01/datafile/o1_mf_vio_95fvpml9_.dbf
output file name=/home/oracle/backup_standby/test_xmit.dbf tag=TAG20140204T120609 RECID=813 STAMP=838642409
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:07:05
Finished backup at 04-FEB-15

Starting Control File and SPFILE Autobackup at 04-FEB-15
piece handle=/u03/app/oracle/flash_recovery_area/SERVER01/autobackup/2015_02_04/o1_mf_s_838642427_9h27yf3j_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 04-FEB-15

2. Copy the datafile from Primary to Standby database server

3. On the standby database server, run

rsync -auvrtz SERVER01.testsrv.local:/home/oracle/backup_standby/test_xmit.dbf /home/oracle/backup_standby/.

4. On the Standby DB server, run

physically drop the datafile
rm /u04/app/oracle/oradata/SERVER01/datafile/o1_mf_vio_95fyo0rh_.dbf

startup mount
on a different session

rman target=/
rman> catalog datafilecopy ‘/home/oracle/backup_standby/test_xmit.dbf';

5. Use target database control file instead of recovery catalog

cataloged datafile copy
datafile copy file name=/home/oracle/backup_standby/test_xmit.dbf RECID=811 STAMP=838644691

rman> list copy of datafile 324;

List of Datafile Copies

Key File S Completion Time Ckp SCN Ckp Time
——- —- – ————— ———- —————
811 324 A 04-FEB-15 289696468470 04-FEB-14
Name: /home/oracle/backup_standby/test_xmit.dbf
Tag: TAG20140204T120609

rman> restore datafile 324;

channel ORA_DISK_1: restoring datafile 00324
input datafile copy RECID=811 STAMP=838644691 file name=/home/oracle/backup_standby/test_xmit.dbf
destination for restore of datafile 00324: /u04/app/oracle/oradata/SERVER01/datafile/o1_mf_vio_95fyo0rh_.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00324
output file name=/u01/app/oracle/oradata/SERVER01/datafile/o1_mf_vio_9h2b7ncs_.dbf RECID=0 STAMP=0
Finished restore at 04-FEB-15

6. From sqlplus, run the following command:

alter database recover managed standby database disconnect;

Leave a Reply