2 - 3 minutes readHow to Copy ASM datafile From Primary Database to Standby Database on ASM

Reader Mode
Method: 1
On Primary database:-

Step 1:- Take an copy of the file to normal file system
RMAN > Copy datafile ‘‘  to ‘‘ ;

Example:  
RMAN>copy datafile '+DATA/orcl/datafile/users.278.658933000'  to '/tmp/backup_file.dbf'
Ftp or copy the datafile backup_file.dbf  to standby server at /tmp/backup_file.dbf
 On Standby database :-

Step 2:- On Standby Catalog this copy using Rman
RMAN> Catalog datafilecopy ‘/tmp/backup_file.dbf’ ;

Step 3:- Stop the Recovery and Switch the datafile to point copy on standby
SQL> Alter database recover managed standby database cancel ;
RMAN > switch datafile to COPY;
For example :-
RMAN> Switch datafile 15 to COPY;
Step 4 :- Now we copy this to ASM disk group on standby
RMAN> Backup as copy datafile   format  ‘‘;
For example:- 
RMAN> Backup as copy datafile 15 format ‘+DATA’ ;
Step 5 :- Switch to point Backup copy created in ASM disk group
RMAN>switch datafile  to COPY;
For example :-
Rman>Switch datafile 15 to Copy ;
Start the recovery 
SQL> Alter database recover managed standby database disconnect from session ;
 
Method: 2

On Primary database: –

Step 1:- Take a copy of the file to normal file system

RMAN>copy datafile ‘+DATA/orcl/datafile/users.278.658933000’ to ‘/tmp/backup_file.dbf’

Ftp or copy the datafile backup_file.dbf to standby server at /tmp/backup_file.dbf

On Stanbdy :-

Step 2

SQL> Shutdown immediate;
SQL> startup mount   ( Note we are not starting the recovery)

Please note if there is dataguard broker running on the standby then it might start the recovery automatically at step 2. You would need to stop the same.

Step 3 

 SQL> Select name from v$datafile where file#=

This will give you the location of the file.(Note it down)


Step 4:- Catalog datafilecopy on Standby using Rman

Rman > Catalog datafilecopy ‘/tmp/backup_file.dbf’ ;


Step 5

Rman > Connect target

Rman> copy datafile ‘/tmp/backup_file.dbf’  to ‘+DATA’

This will report the new location/name of the original file  15.


Step 6

Go to sqlplus on standby database

SQL> Select name from v$datafile where file#=

This will show the original name/location of the datafile. We would need to rename this to the new file name show from above rman command

We would issue rename command to point to the new location of the file.

However we would need to set standby_file_management=manual temporarily for this operation.

SQL>Alter system set standby_file_management=manual scope=spfile ;

SQL> Alter database rename  file ‘‘ to ‘
reported in step3 after copy datafile command>’

For example

SQL> Alter database rename file ‘+DATA/orcl/datafile/users.278.658933000’ to
‘+DATA/orcl/datafile/users.278.658933175’ ;

SQL> Alter system set standby_file_management=auto scope=spfile ;

Related Articles

Responses

Your email address will not be published. Required fields are marked *

Password Reset
Please enter your e-mail address. You will receive a new password via e-mail.