Clone wars
Date: Fri, 12 Dec 2008 12:11:29 +0100
Message-ID: <ghtgt2$6hn$1@news.motzarella.org>
In oracle11g, cloning databases just got easier. MUCH easier. The
"duplicate database" command now has an option "from active database"
which will make a copy of the live database. I tested it on a small DB and
it worked flawlessly. Of course, that is not a good test if your db to clone
is a multi-TB RAC database but it's all I can do for now. Here is the
output. Of course, you need 11g for that.
[oracle_at_dibidus2 admin]$ rman
Recovery Manager: Release 11.1.0.7.0 - Production on Fri Dec 12 11:29:33 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
RMAN> connect auxiliary sys/qwertz_at_stby11
connected to auxiliary database: TEST22 (not mounted)
RMAN> connect target sys/qwertz_at_test11
connected to target database: TEST11 (DBID=3378754816)
RMAN> duplicate target database to test22 from active database;
Starting Duplicate Db at 12-DEC-08
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=153 device type=DISK
allocated channel: ORA_AUX_DISK_2
channel ORA_AUX_DISK_2: SID=152 device type=DISK
contents of Memory Script:
{
set newname for clone datafile 1 to new; set newname for clone datafile 2 to new; set newname for clone datafile 3 to new; set newname for clone datafile 4 to new; set newname for clone datafile 5 to new;backup as copy reuse
datafile 1 auxiliary format new
datafile 2 auxiliary format new
datafile 3 auxiliary format new
datafile 4 auxiliary format new
datafile 5 auxiliary format new
;
sql 'alter system archive log current'; }
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 12-DEC-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=114 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=137 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004
name=/oradata/test11/data/TEST11/datafile/o1_mf_users_4mf46sr1_.dbf
channel ORA_DISK_2: starting datafile copy
input datafile file number=00002
name=/oradata/test11/data/TEST11/datafile/o1_mf_sysaux_4mf46srv_.dbf
output file
name=/oradata/test11/data/STBY11/datafile/o1_mf_sysaux_0tk22if2_.dbf
tag=TAG20081212T113042 RECID=0 STAMP=0
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:05:20
channel ORA_DISK_2: starting datafile copy
input datafile file number=00001
name=/oradata/test11/data/TEST11/datafile/o1_mf_system_4mf46ss2_.dbf
output file
name=/oradata/test11/data/STBY11/datafile/o1_mf_system_0uk22ipf_.dbf
tag=TAG20081212T113042 RECID=0 STAMP=0
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:04:49
channel ORA_DISK_2: starting datafile copy
input datafile file number=00003
name=/oradata/test11/data/TEST11/datafile/o1_mf_undotbs1_4mf46stp_.dbf
output file
name=/oradata/test11/data/STBY11/datafile/o1_mf_undotbs1_0vk22j33_.dbf
tag=TAG20081212T113042 RECID=0 STAMP=0
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:09:17
channel ORA_DISK_2: starting datafile copy
input datafile file number=00005
name=/oradata/test11/data/TEST11/datafile/o1_mf_test_4mf46stx_.dbf
output file
name=/oradata/test11/data/STBY11/datafile/o1_mf_test_10k22jl2_.dbf
tag=TAG20081212T113042 RECID=0 STAMP=0
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:04:36
output file
name=/oradata/test11/data/STBY11/datafile/o1_mf_users_0sk22if2_.dbf
tag=TAG20081212T113042 RECID=0 STAMP=0
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:28:57
Finished backup at 12-DEC-08
sql statement: alter system archive log current sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TEST22" RESETLOGS ARCHIVELOG
MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 2096
LOGFILE
GROUP 1 SIZE 512 M ,
GROUP 2 SIZE 512 M ,
GROUP 3 SIZE 512 M
DATAFILE
'/oradata/test11/data/STBY11/datafile/o1_mf_system_0uk22ipf_.dbf' CHARACTER SET AL32UTF8 contents of Memory Script:
{
backup as copy reuse
archivelog like "/oradata/test11/arch/1_475_672930799.dbf" auxiliary
format
"/oradata/test11/arch/1_475_672930799.dbf" archivelog like
"/oradata/test11/arch/1_476_672930799.dbf" auxiliary format
"/oradata/test11/arch/1_476_672930799.dbf" archivelog like
"/oradata/test11/arch/1_477_672930799.dbf" auxiliary format
"/oradata/test11/arch/1_477_672930799.dbf" archivelog like
"/oradata/test11/arch/1_478_672930799.dbf" auxiliary format
"/oradata/test11/arch/1_478_672930799.dbf" ;
catalog clone archivelog "/oradata/test11/arch/1_475_672930799.dbf"; catalog clone archivelog "/oradata/test11/arch/1_476_672930799.dbf"; catalog clone archivelog "/oradata/test11/arch/1_477_672930799.dbf"; catalog clone archivelog "/oradata/test11/arch/1_478_672930799.dbf";switch clone datafile all;
}
executing Memory Script
Starting backup at 12-DEC-08
using channel ORA_DISK_1
using channel ORA_DISK_2
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=475 RECID=2109 STAMP=673270770
channel ORA_DISK_2: starting archived log copy
input archived log thread=1 sequence=476 RECID=2110 STAMP=673271370
output file name=/oradata/test11/arch/1_475_672930799.dbf RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=477 RECID=2111 STAMP=673271969
output file name=/oradata/test11/arch/1_476_672930799.dbf RECID=0 STAMP=0
channel ORA_DISK_2: archived log copy complete, elapsed time: 00:00:01
channel ORA_DISK_2: starting archived log copy
input archived log thread=1 sequence=478 RECID=2112 STAMP=673271980
output file name=/oradata/test11/arch/1_477_672930799.dbf RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:00
output file name=/oradata/test11/arch/1_478_672930799.dbf RECID=0 STAMP=0
channel ORA_DISK_2: archived log copy complete, elapsed time: 00:00:01
Finished backup at 12-DEC-08
cataloged archived log
archived log file name=/oradata/test11/arch/1_475_672930799.dbf RECID=1
STAMP=673271998
cataloged archived log
archived log file name=/oradata/test11/arch/1_476_672930799.dbf RECID=2
STAMP=673271998
cataloged archived log
archived log file name=/oradata/test11/arch/1_477_672930799.dbf RECID=3
STAMP=673271998
cataloged archived log
archived log file name=/oradata/test11/arch/1_478_672930799.dbf RECID=4
STAMP=673271998
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=673271998 file
name=/oradata/test11/data/STBY11/datafile/o1_mf_sysaux_0tk22if2_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=673271998 file
name=/oradata/test11/data/STBY11/datafile/o1_mf_undotbs1_0vk22j33_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=673271998 file
name=/oradata/test11/data/STBY11/datafile/o1_mf_users_0sk22if2_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=673271998 file
name=/oradata/test11/data/STBY11/datafile/o1_mf_test_10k22jl2_.dbf
contents of Memory Script:
{
set until scn 4691379;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 12-DEC-08
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
starting media recovery
archived log for thread 1 with sequence 475 is already on disk as
file /oradata/test11/arch/1_475_672930799.dbf
archived log for thread 1 with sequence 476 is already on disk as
file /oradata/test11/arch/1_476_672930799.dbf
archived log for thread 1 with sequence 477 is already on disk as
file /oradata/test11/arch/1_477_672930799.dbf
archived log for thread 1 with sequence 478 is already on disk as
file /oradata/test11/arch/1_478_672930799.dbf
archived log file name=/oradata/test11/arch/1_475_672930799.dbf thread=1
sequence=475
archived log file name=/oradata/test11/arch/1_476_672930799.dbf thread=1
sequence=476
archived log file name=/oradata/test11/arch/1_477_672930799.dbf thread=1
sequence=477
archived log file name=/oradata/test11/arch/1_478_672930799.dbf thread=1
sequence=478
media recovery complete, elapsed time: 00:00:02
Finished recover at 12-DEC-08
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount ;
}
executing Memory Script
database dismounted
Oracle instance shut down
connected to auxiliary database (not started) Oracle instance started
Total System Global Area 481259520 bytes
Fixed Size 1314212 bytes Variable Size 377487964 bytes Database Buffers 96468992 bytes Redo Buffers 5988352 bytessql statement: CREATE CONTROLFILE REUSE SET DATABASE "TEST22" RESETLOGS ARCHIVELOG
MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 2096
LOGFILE
GROUP 1 SIZE 512 M ,
GROUP 2 SIZE 512 M ,
GROUP 3 SIZE 512 M
DATAFILE
'/oradata/test11/data/STBY11/datafile/o1_mf_system_0uk22ipf_.dbf' CHARACTER SET AL32UTF8 contents of Memory Script:
{
set newname for clone tempfile 1 to new;
switch clone tempfile all;
catalog clone
datafilecopy "/oradata/test11/data/STBY11/datafile/o1_mf_sysaux_0tk22if2_.dbf";
catalog clone
datafilecopy "/oradata/test11/data/STBY11/datafile/o1_mf_undotbs1_0vk22j33_.dbf";
catalog clone
datafilecopy "/oradata/test11/data/STBY11/datafile/o1_mf_users_0sk22if2_.dbf";
catalog clone
datafilecopy "/oradata/test11/data/STBY11/datafile/o1_mf_test_10k22jl2_.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1
to /oradata/test11/data/STBY11/datafile/o1_mf_temp_%u_.tmp in control file
cataloged datafile copy
datafile copy file
name=/oradata/test11/data/STBY11/datafile/o1_mf_sysaux_0tk22if2_.dbf
RECID=1 STAMP=673272031
cataloged datafile copy
datafile copy file
name=/oradata/test11/data/STBY11/datafile/o1_mf_undotbs1_0vk22j33_.dbf
RECID=2 STAMP=673272033
cataloged datafile copy
datafile copy file
name=/oradata/test11/data/STBY11/datafile/o1_mf_users_0sk22if2_.dbf RECID=3
STAMP=673272035
cataloged datafile copy
datafile copy file
name=/oradata/test11/data/STBY11/datafile/o1_mf_test_10k22jl2_.dbf RECID=4
STAMP=673272037
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=673272031 file
name=/oradata/test11/data/STBY11/datafile/o1_mf_sysaux_0tk22if2_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=673272033 file
name=/oradata/test11/data/STBY11/datafile/o1_mf_undotbs1_0vk22j33_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=673272035 file
name=/oradata/test11/data/STBY11/datafile/o1_mf_users_0sk22if2_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=673272037 file
name=/oradata/test11/data/STBY11/datafile/o1_mf_test_10k22jl2_.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened Finished Duplicate Db at 12-DEC-08
RMAN>
-- http://mgogala.freehostia.comReceived on Fri Dec 12 2008 - 05:11:29 CST