I ran into oracle RMAN bug today and figured it was a good time to add a post on Oracle 10g RMAN duplicates and the work around for the bug I encountered.
The bug is documented on support.oracle.com in Note ID 1076816.1. In short the problem as I was trying to restore up to a sequence time where the sequence had not been recorded in v$log_history or rc_log_history. The work around is to restore to the sequence or a sequence that has been recorded in either v$log_history or rc_log_history.
For an overview of my duplicate procedure.
There is a good note on support.oracle.com for rac database duplicate to asm.
RMAN Duplicate Database From RAC ASM To RAC ASM [ID 461479.1]
I create spfile from pfile and mount and edited pfile on my target server. I then add a tns entry for the database I am cloning on the server where my clone is going to be hosted to allow me to communicate with the target database.
I then create an rman script setting the new names of the files where I am placing them since I am restoring to a different asm disk group than target database uses. This sql script is helpful to set the names for the restored data files.
select 'set newname for datafile ' || file_id || ' to ''+DATA/test/' ||
substr(file_name,instr(file_name,'/',-1)+1) || ''';'
from dba_data_files
set newname for datafile 1 to '+DATA/test/system.311.750536617';
set newname for datafile 3 to '+DATA/test/sysaux.342.750535475';
Here is the sql script to get my max sequence# to restore to.
select max(sequence#) from v$log_history where thread# =1;
Here is what my clone rman rcv script looks like.
run
{
set until sequence 2727 thread 1;
set newname for datafile 1 to '+DATA/test/system.311.750536617';
set newname for datafile 3 to '+DATA/test/sysaux.342.750535475';
... set newnames ...
DUPLICATE TARGET DATABASE TO test;
restore database;
SWITCH DATAFILE ALL;
recover database;
}
Now to run the duplicate, connect to rman on server hosting cloned database.
rman target sys@mytargetdb auxiliary / catalog rmancat/rmancatpwd@emrep
@duplicate.rcv
No comments:
Post a Comment