Copy backup of datafile from one ASM system to Another ASM system.
==============================================================
This Article has been written for Primary and Standby database Configuration .
The Steps below are useful especially when you encounter NO LOGGING/Corruption errors in standby database and want to copy the current/good backup of datafile in Primary which is on ASM to Standby database which is on ASM
For example :-
ORA-01578: ORACLE data block corrupted (file # 15, block # 834)
ORA-01110: data file 15: '+DATA/orcl/datafile/users.278.658933000' '
ORA-26040: Data block was loaded using the NOLOGGING option
Solution
There are two options to achieve the same.
Before we proceed with the steps above.We are assuming all the datafiles are on Disk group +DATA.
Assuming in this Scenario file 15 on Standby has corruption or is reported NO LOGGING operation error.
Location of file 15 in Primary database is '+DATA/orcl/datafile/users.278.658933000' .
Both standby and primary are on two separate servers.
Option 1
On Primary database :-
Step 1:- Take an copy of the file to normal file system
Rman > Copy datafile '' to '' ;
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' ;
Message Similar to the lines below would be display
cataloged datafile copy
datafile copy filename=/tmp/backup_file.dbf recid=18 stamp=658950108
Step 3:- Switch the datafile to point copy on standby
Stop the recovery
SQL> Alter database recover managed standby database cancel ;
Rman > switch datafile to COPY;
For example :-
RMAN> Switch datafile 15 to COPY;
datafile 15 switched to datafile copy "/tmp/backup_file.dbf "
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' ;
Starting backup at 01-JUL-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=21 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00015 name=/tmp/backup_file.dbf
output filename=+DATA/orcl/datafile/users.278.658933000 tag=TAG20080701T174306 r ecid=20 stamp=658950191
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 01-JUL-08
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 ;
Or
Option 2
On Primary database :-
Step 1:- Take an 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'
Starting backup at 01-JUL-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input is copy of datafile 00015: /tmp/backup_file.dbf
output filename=+DATA/orcl/datafile/users.278.658933175 tag=TAG20080701T125709 r ===> Name reported
ecid=8 stamp=658933188
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:17
Finished backup at 01-JUL-08
This will report the new location/name of the original file 15.
In this example its +DATA/orcl/datafile/users.278.658933175
Step 5
Go to sqlplus on standby database
SQL> Select name from v$datafile where file#=
For example
SQL> Select name from v$datafile where file#=15
'+DATA/orcl/datafile/users.278.658933000'
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 ;
==============================================================
This Article has been written for Primary and Standby database Configuration .
The Steps below are useful especially when you encounter NO LOGGING/Corruption errors in standby database and want to copy the current/good backup of datafile in Primary which is on ASM to Standby database which is on ASM
For example :-
ORA-01578: ORACLE data block corrupted (file # 15, block # 834)
ORA-01110: data file 15: '+DATA/orcl/datafile/users.278.658933000' '
ORA-26040: Data block was loaded using the NOLOGGING option
Solution
There are two options to achieve the same.
Before we proceed with the steps above.We are assuming all the datafiles are on Disk group +DATA.
Assuming in this Scenario file 15 on Standby has corruption or is reported NO LOGGING operation error.
Location of file 15 in Primary database is '+DATA/orcl/datafile/users.278.658933000' .
Both standby and primary are on two separate servers.
Option 1
On Primary database :-
Step 1:- Take an copy of the file to normal file system
Rman > Copy datafile '
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' ;
Message Similar to the lines below would be display
cataloged datafile copy
datafile copy filename=/tmp/backup_file.dbf recid=18 stamp=658950108
Step 3:- Switch the datafile to point copy on standby
Stop the recovery
SQL> Alter database recover managed standby database cancel ;
Rman > switch datafile
For example :-
RMAN> Switch datafile 15 to COPY;
datafile 15 switched to datafile copy "/tmp/backup_file.dbf "
Step 4 :- Now we copy this to ASM disk group on standby
RMAN> Backup as copy datafile
For example :-
Rman> Backup as copy datafile 15 format '+DATA' ;
Starting backup at 01-JUL-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=21 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00015 name=/tmp/backup_file.dbf
output filename=+DATA/orcl/datafile/users.278.658933000 tag=TAG20080701T174306 r ecid=20 stamp=658950191
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 01-JUL-08
Step 5 :- Switch to point Backup copy created in ASM disk group
RMAN>switch datafile
For example :-
Rman>Switch datafile 15 to Copy ;
Start the recovery
SQL> Alter database recover managed standby database disconnect from session ;
Or
Option 2
On Primary database :-
Step 1:- Take an 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'
Starting backup at 01-JUL-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input is copy of datafile 00015: /tmp/backup_file.dbf
output filename=+DATA/orcl/datafile/users.278.658933175 tag=TAG20080701T125709 r ===> Name reported
ecid=8 stamp=658933188
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:17
Finished backup at 01-JUL-08
This will report the new location/name of the original file 15.
In this example its +DATA/orcl/datafile/users.278.658933175
Step 5
Go to sqlplus on standby database
SQL> Select name from v$datafile where file#=
For example
SQL> Select name from v$datafile where file#=15
'+DATA/orcl/datafile/users.278.658933000'
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 '
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 ;