Wednesday, May 2, 2012

Restart failed duplicate

A while ago i was duplicating a database from production to test.
All went well untill the duplicate failed because the filesystems where the archives where
restored to was 100 % full.
After fixing that problem a didn't want to start the duplicate again from the beginning because
it would set me back for an hour of 4.
I found a nice solution so you can restart the duplicate whitout restoring the datafiles first.(I've got those already restored the first i started the duplication).

I've used this rman command to do that

connect auxiliary sys/i@ORAECOD1;
connect target sys/i@REPRO_ORAPCOD1;
connect catalog rmnp_own/@ocrm04p;
run {
set until time  "to_date('Apr 12 2012 23:00:00','Mon DD YYYY HH24:MI:SS')";
allocate auxiliary channel aux_1 type  'sbt_tape';
allocate auxiliary channel aux_2 type  'sbt_tape';
recover clone database delete archivelog;
alter clone database open resetlogs; 
}

Now you must NID to change the dbid

$ nid target=sys/oracle
DBNEWID: Release 10.2.0.1.0 - Production on Fri Mar 10 22:54:42 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to database TEST (DBID=124048422)
Connected to server version 11.2.0
Control Files in database:
/oracle/TEST/data_80/CONTROL01.CTL
/oralcle/TEST/data_81/CONTROL02.CTL
Change database ID of database TEST? (Y/[N]) => Y
The red line did the trick. It saved me 4 hours.

No comments:

Post a Comment