The diagram below illustrates a typical test and dev environment that can be created and managed with the gDBClone command.
gDBClone Command Syntax
We have setup the following configuration
- An Oracle database 12c server
- Oracle standalone clusterware
- ADVM : acfs_asm01 on mountpoint /acfs_snap
mkdir /acfs_snap mount -t acfs /dev/asm/acfs_asm01-410 /acfs_snap chown -R oracle:dba /acfs_snap/ mount | grep acfs /dev/asm/acfs_asm01-410 on /acfs_snap type acfs (rw)
Install the script on your system. Upload the script to your staging area. The copy the scrip to the 12c RDBM software binary. Login as root on the system set your ORACLE_HOME environment. The script gDBClone must be executed as root on the system.
cp gDBClone $ORACLE_HOME/bin/gDBClone ls -trl $ORACLE_HOME/bin/gDBClone -rwxr-x--- 1 root root 77533 Jun 26 13:10 /u01/app/oracle/product/12.1.0/dbhome_1/bin/gDBClone
To successful run the gDBClone script on a standalone cluster you have to edit the script? The script works perfect on an Oracle cluster environment. The changes that have to be done are based on the srvctl commands in the script.
- -c SINGLE -x $host is a setting which is not present on a standalone cluster
- srvctl modify database -d $tdbname -j $acfs host is a setting which is not present on a standalone cluster
Things to think about when using the gDBClone script
- Setting of sqlnet.ora has to support hostname resolving. The script validate the listener based on the hostname provided.
- ADVM compatibility must be set to 12.1.0.0.
- Database in ARCHIVELOG mode
- Change the gDBClone script when it will be used on a standalone cluster.
- Think about selinux setting , set to disable
Create ASM Database db01
create the database on ASM and enable archivelogdbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname db01 -sid db01 -sysPassword welcome1 -systemPassword welcome1 -emConfiguration none -storageType ASM -asmsnmpPassword welcome1 -diskGroupName data -recoveryGroupName data -totalMemory 1024
Create Clone from ASM to ACFS with gDBClone
login as root on the target database server en set ORACLE_HOME. In my environment the source and target database server are the same. I will create a MASTER clone "CLONE01" from the ASM database DB01.gDBClone clone -sdbname db01 -sdbhost em12c -sdbport 1521 -tdbname clone01 -tdbport 1521 -acfs /acfs_snap -racmod 0 -debug
2015-06-26 12:20:03: I Checking source host em12c... 2015-06-26 12:20:03: D Executing: ping -q -c 1 em12c > /dev/null 2>&1 2015-06-26 12:20:03: D Exit code: 0 2015-06-26 12:20:03: I Getting host info... 2015-06-26 12:20:03: D Executing: hostname -f 2015-06-26 12:20:03: D Exit code: 0 2015-06-26 12:20:03: D Output of last command execution: 2015-06-26 12:20:03: I Starting..... 2015-06-26 12:20:03: I Validating environment..... 2015-06-26 12:20:03: D Executing: /u03/app/grid/product/12.1.0/grid/bin/olsnodes 2015-06-26 12:20:03: D Exit code: 0 2015-06-26 12:20:03: D Output of last command execution: Enter the source db01 SYSDBA password: 2015-06-26 12:20:06: I Checking SCAN listener em12c:1521... 2015-06-26 12:20:06: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/tnsping em12c:1521 >/dev/null' 2015-06-26 12:20:06: D Exit code: 0 2015-06-26 12:20:07: I Getting OH version... 2015-06-26 12:20:07: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/OPatch/opatch lsinventory | grep "Database 11g"' 2015-06-26 12:20:10: D Exit code: 1 2015-06-26 12:20:10: D Output of last command execution: 2015-06-26 12:20:10: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/OPatch/opatch lsinventory | grep "Database 12c"' 2015-06-26 12:20:14: D Exit code: 0 2015-06-26 12:20:14: D Output of last command execution: 2015-06-26 12:20:14: I Checking SCAN listener em12c.sainath.com:1521... 2015-06-26 12:20:14: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/tnsping em12c.sainath.com:1521 >/dev/null' 2015-06-26 12:20:14: D Exit code: 0 2015-06-26 12:20:14: I Checking database CLONE01 existence... 2015-06-26 12:20:14: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/srvctl config database -d CLONE01 >/dev/null' 2015-06-26 12:20:15: D Exit code: 1 2015-06-26 12:20:15: I Checking registered instance CLONE01 ... 2015-06-26 12:20:16: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/srvctl config database -d db01 |grep instances' 2015-06-26 12:20:17: D Exit code: 1 2015-06-26 12:20:17: D Output of last command execution: 2015-06-26 12:20:17: I Checking if the /acfs_snap is an ACFS file system 2015-06-26 12:20:17: D Executing: acfsutil info fs /acfs_snap > /dev/null 2>&1 2015-06-26 12:20:17: D Exit code: 0 2015-06-26 12:20:17: D Output of last command execution: 2015-06-26 12:20:17: I Checking if the Source Database db01 it's on ASM 2015-06-26 12:20:18: I Source Database db01 it's on ASM 2015-06-26 12:20:18: I Setting up clone environment.... 2015-06-26 12:20:18: D Executing: su oracle -c 'touch /u01/app/oracle/product/12.1.0/dbhome_1/dbs/initCLONE01.ora' 2015-06-26 12:20:18: D Exit code: 0 2015-06-26 12:20:18: D Output of last command execution: 2015-06-26 12:20:18: D Executing: su oracle -c 'mkdir -p /u01/app/oracle/admin/CLONE01/adump' 2015-06-26 12:20:18: D Exit code: 0 2015-06-26 12:20:18: D Output of last command execution: 2015-06-26 12:20:18: I Starting auxiliary listener.... 2015-06-26 12:20:18: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/lsnrctl start listener_clone' 2015-06-26 12:20:18: D Exit code: 0 2015-06-26 12:20:18: D Output of last command execution: 2015-06-26 12:20:18: D 2015-06-26 12:21:18: I Creating base ACFS snapshot..... 2015-06-26 12:21:18: D Executing: acfsutil snap create -w CLONE01 /acfs_snap 2015-06-26 12:21:18: D Exit code: 0 2015-06-26 12:21:18: D Output of last command execution: 2015-06-26 12:21:18: I Creating dynamic scripts..... 2015-06-26 12:21:18: I Cloning to target ACFS from host em12c 2015-06-26 12:21:18: I Spfile to target ACFS 2015-06-26 12:21:18: D Executing: su oracle -c 'mkdir -p /acfs_snap/.ACFS/snaps/CLONE01' 2015-06-26 12:21:18: D Exit code: 0 2015-06-26 12:21:18: D Output of last command execution: 2015-06-26 12:21:18: I Instantiating clone database..... 2015-06-26 12:21:18: I please wait (this can take a while depending on database size and/or network speed) 2015-06-26 12:21:18: D Executing: su oracle -c 'mkdir -p /acfs_snap/.ACFS/snaps/CLONE01' 2015-06-26 12:21:18: D Exit code: 0 2015-06-26 12:21:18: D Output of last command execution: 2015-06-26 12:21:18: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/rman target sys/welcome1@//em12c:1521/db01 auxiliary sys/welcome1@//em12c.sainath.com:35007/CLONE01 cmdfile /var/log/gDBClone/dup.scr' Recovery Manager: Release 12.1.0.2.0 - Production on Fri Jun 26 12:21:18 2015 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. connected to target database: DB01 (DBID=1514591559) connected to auxiliary database (not started) RMAN> sql 'alter system archive log current'; 2> startup clone nomount; 3> run { 4> allocate channel tgt1 device type disk; 5> allocate channel tgt2 device type disk; 6> allocate channel tgt3 device type disk; 7> allocate auxiliary channel aux1 device type disk; 8> allocate auxiliary channel aux2 device type disk; 9> allocate auxiliary channel aux3 device type disk; 10> DUPLICATE TARGET DATABASE 11> TO 'CLONE01' 12> FROM ACTIVE DATABASE 13> SPFILE 14> PARAMETER_VALUE_CONVERT='db01','CLONE01' 15> SET CONTROL_FILES='/acfs_snap/.ACFS/snaps/CLONE01/control01.ctl' 16> SET DB_UNIQUE_NAME="CLONE01" 17> SET CLUSTER_DATABASE='false' 18> SET DB_CREATE_FILE_DEST="/acfs_snap/.ACFS/snaps/CLONE01" 19> SET REMOTE_LISTENER="em12c.sainath.com:1521" 20> SET DIAGNOSTIC_DEST="/u01/app/oracle" 21> SET AUDIT_FILE_DEST="/u01/app/oracle/admin/CLONE01/adump" 22> SET DB_RECOVERY_FILE_DEST="/acfs_snap/.ACFS/snaps/CLONE01" 23> SET DB_CREATE_ONLINE_LOG_DEST_1="/acfs_snap/.ACFS/snaps/CLONE01" 24> SET DB_RECOVERY_FILE_DEST_SIZE='10G' 25> NOFILENAMECHECK; 26> } 27> using target database control file instead of recovery catalog sql statement: alter system archive log current Oracle instance started Total System Global Area 272629760 bytes Fixed Size 2923336 bytes Variable Size 213910712 bytes Database Buffers 50331648 bytes Redo Buffers 5464064 bytes allocated channel: tgt1 channel tgt1: SID=362 device type=DISK allocated channel: tgt2 channel tgt2: SID=374 device type=DISK allocated channel: tgt3 channel tgt3: SID=13 device type=DISK allocated channel: aux1 channel aux1: SID=7 device type=DISK allocated channel: aux2 channel aux2: SID=147 device type=DISK allocated channel: aux3 channel aux3: SID=289 device type=DISK Starting Duplicate Db at 26-JUN-15 current log archived contents of Memory Script: { restore clone from service '//em12c:1521/db01' spfile to '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfileCLONE01.ora'; sql clone "alter system set spfile= ''/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfileCLONE01.ora''"; } executing Memory Script Starting restore at 26-JUN-15 channel aux1: starting datafile backup set restore channel aux1: using network backup set from service //em12c:1521/db01 channel aux1: restoring SPFILE output file name=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfileCLONE01.ora channel aux1: restore complete, elapsed time: 00:00:02 Finished restore at 26-JUN-15 sql statement: alter system set spfile= ''/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfileCLONE01.ora'' contents of Memory Script: { sql clone "alter system set db_name = ''CLONE01'' comment= ''duplicate'' scope=spfile"; sql clone "alter system set dispatchers = ''(PROTOCOL=TCP) (SERVICE=CLONE01XDB)'' comment= '''' scope=spfile"; sql clone "alter system set CONTROL_FILES = ''/acfs_snap/.ACFS/snaps/CLONE01/control01.ctl'' comment= '''' scope=spfile"; sql clone "alter system set db_unique_name = ''CLONE01'' comment= '''' scope=spfile"; sql clone "alter system set CLUSTER_DATABASE = false comment= '''' scope=spfile"; sql clone "alter system set DB_CREATE_FILE_DEST = ''/acfs_snap/.ACFS/snaps/CLONE01'' comment= '''' scope=spfile"; sql clone "alter system set REMOTE_LISTENER = ''em12c.sainath.com:1521'' comment= '''' scope=spfile"; sql clone "alter system set DIAGNOSTIC_DEST = ''/u01/app/oracle'' comment= '''' scope=spfile"; sql clone "alter system set AUDIT_FILE_DEST = ''/u01/app/oracle/admin/CLONE01/adump'' comment= '''' scope=spfile"; sql clone "alter system set db_recovery_file_dest = ''/acfs_snap/.ACFS/snaps/CLONE01'' comment= '''' scope=spfile"; sql clone "alter system set DB_CREATE_ONLINE_LOG_DEST_1 = ''/acfs_snap/.ACFS/snaps/CLONE01'' comment= '''' scope=spfile"; sql clone "alter system set DB_RECOVERY_FILE_DEST_SIZE = 10G comment= '''' scope=spfile"; shutdown clone immediate; startup clone nomount; } executing Memory Script sql statement: alter system set db_name = ''CLONE01'' comment= ''duplicate'' scope=spfile sql statement: alter system set dispatchers = ''(PROTOCOL=TCP) (SERVICE=CLONE01XDB)'' comment= '''' scope=spfile sql statement: alter system set CONTROL_FILES = ''/acfs_snap/.ACFS/snaps/CLONE01/control01.ctl'' comment= '''' scope=spfile sql statement: alter system set db_unique_name = ''CLONE01'' comment= '''' scope=spfile sql statement: alter system set CLUSTER_DATABASE = false comment= '''' scope=spfile sql statement: alter system set DB_CREATE_FILE_DEST = ''/acfs_snap/.ACFS/snaps/CLONE01'' comment= '''' scope=spfile sql statement: alter system set REMOTE_LISTENER = ''em12c.sainath.com:1521'' comment= '''' scope=spfile sql statement: alter system set DIAGNOSTIC_DEST = ''/u01/app/oracle'' comment= '''' scope=spfile sql statement: alter system set AUDIT_FILE_DEST = ''/u01/app/oracle/admin/CLONE01/adump'' comment= '''' scope=spfile sql statement: alter system set db_recovery_file_dest = ''/acfs_snap/.ACFS/snaps/CLONE01'' comment= '''' scope=spfile sql statement: alter system set DB_CREATE_ONLINE_LOG_DEST_1 = ''/acfs_snap/.ACFS/snaps/CLONE01'' comment= '''' scope=spfile sql statement: alter system set DB_RECOVERY_FILE_DEST_SIZE = 10G comment= '''' scope=spfile Oracle instance shut down connected to auxiliary database (not started) Oracle instance started Total System Global Area 805306368 bytes Fixed Size 2929552 bytes Variable Size 331353200 bytes Database Buffers 465567744 bytes Redo Buffers 5455872 bytes allocated channel: aux1 channel aux1: SID=243 device type=DISK allocated channel: aux2 channel aux2: SID=357 device type=DISK allocated channel: aux3 channel aux3: SID=6 device type=DISK contents of Memory Script: { sql clone "alter system set db_name = ''DB01'' comment= ''Modified by RMAN duplicate'' scope=spfile"; sql clone "alter system set db_unique_name = ''CLONE01'' comment= ''Modified by RMAN duplicate'' scope=spfile"; shutdown clone immediate; startup clone force nomount restore clone from service '//em12c:1521/db01' primary controlfile; alter clone database mount; } executing Memory Script sql statement: alter system set db_name = ''DB01'' comment= ''Modified by RMAN duplicate'' scope=spfile sql statement: alter system set db_unique_name = ''CLONE01'' comment= ''Modified by RMAN duplicate'' scope=spfile Oracle instance shut down Oracle instance started Total System Global Area 805306368 bytes Fixed Size 2929552 bytes Variable Size 331353200 bytes Database Buffers 465567744 bytes Redo Buffers 5455872 bytes allocated channel: aux1 channel aux1: SID=243 device type=DISK allocated channel: aux2 channel aux2: SID=357 device type=DISK allocated channel: aux3 channel aux3: SID=6 device type=DISK Starting restore at 26-JUN-15 channel aux1: starting datafile backup set restore channel aux1: using network backup set from service //em12c:1521/db01 channel aux1: restoring control file channel aux1: restore complete, elapsed time: 00:00:02 output file name=/acfs_snap/.ACFS/snaps/CLONE01/control01.ctl Finished restore at 26-JUN-15 database mounted contents of Memory Script: { set newname for clone datafile 1 to new; set newname for clone datafile 3 to new; set newname for clone datafile 4 to new; set newname for clone datafile 6 to new; restore from service '//em12c:1521/db01' clone database ; 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 Starting restore at 26-JUN-15 channel aux1: starting datafile backup set restore channel aux1: using network backup set from service //em12c:1521/db01 channel aux1: specifying datafile(s) to restore from backup set channel aux1: restoring datafile 00001 to /acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_system_%u_.dbf channel aux2: starting datafile backup set restore channel aux2: using network backup set from service //em12c:1521/db01 channel aux2: specifying datafile(s) to restore from backup set channel aux2: restoring datafile 00003 to /acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_sysaux_%u_.dbf channel aux3: starting datafile backup set restore channel aux3: using network backup set from service //em12c:1521/db01 channel aux3: specifying datafile(s) to restore from backup set channel aux3: restoring datafile 00004 to /acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_undotbs1_%u_.dbf channel aux3: restore complete, elapsed time: 00:00:26 channel aux3: starting datafile backup set restore channel aux3: using network backup set from service //em12c:1521/db01 channel aux3: specifying datafile(s) to restore from backup set channel aux3: restoring datafile 00006 to /acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_users_%u_.dbf channel aux2: restore complete, elapsed time: 00:00:36 channel aux1: restore complete, elapsed time: 00:00:51 channel aux3: restore complete, elapsed time: 00:00:25 Finished restore at 26-JUN-15 sql statement: alter system archive log current current log archived contents of Memory Script: { restore clone force from service '//em12c:1521/db01' archivelog from scn 1954555; switch clone datafile all; } executing Memory Script Starting restore at 26-JUN-15 channel aux1: starting archived log restore to default destination channel aux1: using network backup set from service //em12c:1521/db01 channel aux1: restoring archived log archived log thread=1 sequence=29 channel aux2: starting archived log restore to default destination channel aux2: using network backup set from service //em12c:1521/db01 channel aux2: restoring archived log archived log thread=1 sequence=30 channel aux1: restore complete, elapsed time: 00:00:00 channel aux2: restore complete, elapsed time: 00:00:01 Finished restore at 26-JUN-15 datafile 1 switched to datafile copy input datafile copy RECID=5 STAMP=883398201 file name=/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_system_brt9z4rw_.dbf datafile 3 switched to datafile copy input datafile copy RECID=6 STAMP=883398201 file name=/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_sysaux_brt9z50o_.dbf datafile 4 switched to datafile copy input datafile copy RECID=7 STAMP=883398201 file name=/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_undotbs1_brt9z9kf_.dbf datafile 6 switched to datafile copy input datafile copy RECID=8 STAMP=883398201 file name=/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_users_brtb0lg1_.dbf contents of Memory Script: { set until scn 1954730; recover clone database delete archivelog ; } executing Memory Script executing command: SET until clause Starting recover at 26-JUN-15 starting media recovery archived log for thread 1 with sequence 29 is already on disk as file /acfs_snap/.ACFS/snaps/CLONE01/CLONE01/archivelog/2015_06_26/o1_mf_1_29_brtb0rl9_.arc archived log for thread 1 with sequence 30 is already on disk as file /acfs_snap/.ACFS/snaps/CLONE01/CLONE01/archivelog/2015_06_26/o1_mf_1_30_brtb0rvn_.arc archived log file name=/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/archivelog/2015_06_26/o1_mf_1_29_brtb0rl9_.arc thread=1 sequence=29 archived log file name=/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/archivelog/2015_06_26/o1_mf_1_30_brtb0rvn_.arc thread=1 sequence=30 media recovery complete, elapsed time: 00:00:04 Finished recover at 26-JUN-15 Oracle instance started Total System Global Area 805306368 bytes Fixed Size 2929552 bytes Variable Size 331353200 bytes Database Buffers 465567744 bytes Redo Buffers 5455872 bytes contents of Memory Script: { sql clone "alter system set db_name = ''CLONE01'' comment= ''Reset to original value by RMAN'' scope=spfile"; sql clone "alter system reset db_unique_name scope=spfile"; } executing Memory Script sql statement: alter system set db_name = ''CLONE01'' comment= ''Reset to original value by RMAN'' scope=spfile sql statement: alter system reset db_unique_name scope=spfile Oracle instance started Total System Global Area 805306368 bytes Fixed Size 2929552 bytes Variable Size 331353200 bytes Database Buffers 465567744 bytes Redo Buffers 5455872 bytes sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CLONE01" RESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 SIZE 50 M , GROUP 2 SIZE 50 M , GROUP 3 SIZE 50 M DATAFILE '/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_system_brt9z4rw_.dbf' CHARACTER SET WE8MSWIN1252 contents of Memory Script: { set newname for clone tempfile 1 to new; switch clone tempfile all; catalog clone datafilecopy "/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_sysaux_brt9z50o_.dbf", "/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_undotbs1_brt9z9kf_.dbf", "/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_users_brtb0lg1_.dbf"; switch clone datafile all; } executing Memory Script executing command: SET NEWNAME renamed tempfile 1 to /acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_temp_%u_.tmp in control file cataloged datafile copy datafile copy file name=/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_sysaux_brt9z50o_.dbf RECID=1 STAMP=883398228 cataloged datafile copy datafile copy file name=/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_undotbs1_brt9z9kf_.dbf RECID=2 STAMP=883398228 cataloged datafile copy datafile copy file name=/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_users_brtb0lg1_.dbf RECID=3 STAMP=883398228 datafile 3 switched to datafile copy input datafile copy RECID=1 STAMP=883398228 file name=/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_sysaux_brt9z50o_.dbf datafile 4 switched to datafile copy input datafile copy RECID=2 STAMP=883398228 file name=/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_undotbs1_brt9z9kf_.dbf datafile 6 switched to datafile copy input datafile copy RECID=3 STAMP=883398228 file name=/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/datafile/o1_mf_users_brtb0lg1_.dbf contents of Memory Script: { Alter clone database open resetlogs; } executing Memory Script database opened Finished Duplicate Db at 26-JUN-15 released channel: tgt1 released channel: tgt2 released channel: tgt3 Recovery Manager complete. 2015-06-26 12:23:54: D Exit code: 0 2015-06-26 12:23:54: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/rman target sys/welcome1@//em12c.sainath.com:35007/CLONE01 cmdfile /var/log/gDBClone/mov.scr' Recovery Manager: Release 12.1.0.2.0 - Production on Fri Jun 26 12:23:54 2015 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. connected to target database: CLONE01 (DBID=3531661844) RMAN> backup spfile; 2> restore spfile to "/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/spfileCLONE01.ora"; 3> shutdown immediate; 4> Starting backup at 26-JUN-15 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=130 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 26-JUN-15 channel ORA_DISK_1: finished piece 1 at 26-JUN-15 piece handle=/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/backupset/2015_06_26/o1_mf_nnsnf_TAG20150626T122358_brtb1yds_.bkp tag=TAG20150626T122358 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 26-JUN-15 Starting restore at 26-JUN-15 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: restoring SPFILE output file name=/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/spfileCLONE01.ora channel ORA_DISK_1: reading from backup piece /acfs_snap/.ACFS/snaps/CLONE01/CLONE01/backupset/2015_06_26/o1_mf_nnsnf_TAG20150626T122358_brtb1yds_.bkp channel ORA_DISK_1: piece handle=/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/backupset/2015_06_26/o1_mf_nnsnf_TAG20150626T122358_brtb1yds_.bkp tag=TAG20150626T122358 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 Finished restore at 26-JUN-15 database closed database dismounted Oracle instance shut down Recovery Manager complete. 2015-06-26 12:24:17: D Exit code: 0 2015-06-26 12:24:17: D Executing: su oracle -c 'touch /u01/app/oracle/product/12.1.0/dbhome_1/dbs/initCLONE01.ora' 2015-06-26 12:24:17: D Exit code: 0 2015-06-26 12:24:17: D Output of last command execution: 2015-06-26 12:24:17: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/srvctl add database -d CLONE01 -o /u01/app/oracle/product/12.1.0/dbhome_1 -p "/acfs_snap/.ACFS/snaps/CLONE01/CLONE01/spfileCLONE01.ora" -s open' 2015-06-26 12:24:19: D Exit code: 0 2015-06-26 12:24:19: D Output of last command execution: System altered. 2015-06-26 12:24:19: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/srvctl modify database -d CLONE01 -i CLONE01' 2015-06-26 12:24:20: D Exit code: 0 2015-06-26 12:24:20: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/srvctl modify database -d CLONE01 -z' 2015-06-26 12:24:21: D Exit code: 0 2015-06-26 12:24:21: I Successfully created clone "CLONE01" database 2015-06-26 12:24:21: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/lsnrctl stop listener_clone >/dev/null' 2015-06-26 12:24:21: D Exit code:
Validation of the created CLONE
gDBClone listdb
Database Name Database Type Database Role Location/Parent ------------- ------------- ---------------- ---------------- CLONE01 SINGLE Master /acfs_snap/.ACFS/snaps/
Validation of the CRS information for the new database
/u03/app/grid/product/12.1.0/grid/bin/crsctl status resource -w "TYPE = ora.database.type" -t
-------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.clone01.db 1 OFFLINE OFFLINE STABLE ora.db01.db 1 ONLINE ONLINE em12c Open,STABLE --------------------------------------------------------------------------------
srvctl start database -d clone01
/u03/app/grid/product/12.1.0/grid/bin/crsctl status resource -w "TYPE = ora.database.type" -t
-------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.clone01.db 1 ONLINE ONLINE em12c Open,STABLE ora.db01.db 1 ONLINE ONLINE em12c Open,STABLE --------------------------------------------------------------------------------
ps -ef|grep smon oracle 2379 1 0 10:33 ? 00:00:00 asm_smon_+ASM oracle 2604 1 0 10:33 ? 00:00:00 ora_smon_db01 oracle 13469 1 0 12:54 ? 00:00:00 ora_smon_CLONE01 root 13882 2635 0 12:54 pts/0 00:00:00 grep smon
Create SNAP from MASTER clone with gDBClone
gDBClone snap -sdbname clone01 -tdbname clone02 -debug 2015-06-26 13:12:54: I Getting host info... 2015-06-26 13:12:54: D Executing: hostname -f 2015-06-26 13:12:54: D Exit code: 0 2015-06-26 13:12:54: D Output of last command execution: 2015-06-26 13:12:54: I Starting..... 2015-06-26 13:12:54: I Validating environment..... 2015-06-26 13:12:54: D Executing: /u03/app/grid/product/12.1.0/grid/bin/olsnodes 2015-06-26 13:12:54: D Exit code: 0 2015-06-26 13:12:54: D Output of last command execution: Enter the source CLONE01 SYSDBA password: 2015-06-26 13:13:01: I Getting OH version... 2015-06-26 13:13:01: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/OPatch/opatch lsinventory | grep "Database 11g"' 2015-06-26 13:13:06: D Exit code: 1 2015-06-26 13:13:06: D Output of last command execution: 2015-06-26 13:13:06: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/OPatch/opatch lsinventory | grep "Database 12c"' 2015-06-26 13:13:10: D Exit code: 0 2015-06-26 13:13:10: D Output of last command execution: 2015-06-26 13:13:10: I Checking SCAN listener em12c.sainath.com:1521... 2015-06-26 13:13:10: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/tnsping em12c.sainath.com:1521 >/dev/null' 2015-06-26 13:13:10: D Exit code: 0 2015-06-26 13:13:10: I Checking database CLONE02 existence... 2015-06-26 13:13:10: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/srvctl config database -d CLONE02 >/dev/null' 2015-06-26 13:13:11: D Exit code: 1 2015-06-26 13:13:11: I Checking registered instance CLONE02 ... 2015-06-26 13:13:11: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/srvctl config database -d CLONE01 |grep instances' 2015-06-26 13:13:13: D Exit code: 1 2015-06-26 13:13:13: D Output of last command execution: 2015-06-26 13:13:13: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/srvctl config database -d db01 |grep instances' 2015-06-26 13:13:14: D Exit code: 1 2015-06-26 13:13:14: D Output of last command execution: 2015-06-26 13:13:14: I Checking if the Source Database CLONE01 it's on ASM 2015-06-26 13:13:15: I Source Database CLONE01 it's on ACFS 2015-06-26 13:13:15: I Checking snapshot CLONE02 existence 2015-06-26 13:13:15: D Executing: acfsutil snap info CLONE02 /acfs_snap > /dev/null 2>&1 2015-06-26 13:13:15: D Exit code: 1 2015-06-26 13:13:15: D Output of last command execution: 2015-06-26 13:13:15: I Setting up clone environment.... 2015-06-26 13:13:15: D Executing: su oracle -c 'touch /u01/app/oracle/product/12.1.0/dbhome_1/dbs/initCLONE02.ora' 2015-06-26 13:13:15: D Exit code: 0 2015-06-26 13:13:15: D Output of last command execution: 2015-06-26 13:13:15: D Executing: su oracle -c 'mkdir -p /u01/app/oracle/admin/CLONE02/adump' 2015-06-26 13:13:15: D Exit code: 0 2015-06-26 13:13:15: D Output of last command execution: 2015-06-26 13:13:15: I Starting auxiliary listener.... 2015-06-26 13:13:15: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/lsnrctl start listener_clone' 2015-06-26 13:13:15: D Exit code: 0 2015-06-26 13:13:15: D Output of last command execution: 2015-06-26 13:13:15: D 2015-06-26 13:14:15: I Creating ACFS snapshot..... 2015-06-26 13:14:15: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/srvctl stop database -d CLONE01' 2015-06-26 13:14:31: D Exit code: 0 2015-06-26 13:14:31: D Output of last command execution: 2015-06-26 13:14:31: I Checking if the source database CLONE01 is stored on an ACFS snapshot 2015-06-26 13:14:31: I The source database CLONE01 is running on an ACFS snapshot 2015-06-26 13:14:31: D Executing: acfsutil snap create -w -p CLONE01 CLONE02 /acfs_snap 2015-06-26 13:14:31: D Exit code: 0 2015-06-26 13:14:31: D Output of last command execution: 2015-06-26 13:14:31: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/srvctl start database -d CLONE01' 2015-06-26 13:14:42: D Exit code: 0 2015-06-26 13:14:42: I Setting up snapshot database..... 2015-06-26 13:14:42: I Creating Clone parameter files 2015-06-26 13:14:42: D Executing: export ORACLE_SID=CLONE02; echo exit | /u01/app/oracle/product/12.1.0/dbhome_1/bin/sqlplus sys/welcome1 as sysdba @/var/log/gDBClone/pfile.sql 2015-06-26 13:14:44: D Exit code: 0 2015-06-26 13:14:44: D Output of last command execution: 2015-06-26 13:14:44: D 2015-06-26 13:14:44: D Executing: export ORACLE_SID=CLONE02; echo exit | /u01/app/oracle/product/12.1.0/dbhome_1/bin/sqlplus sys/welcome1 as sysdba @/var/log/gDBClone/spfile.sql 2015-06-26 13:14:45: D Exit code: 0 2015-06-26 13:14:45: D Output of last command execution: 2015-06-26 13:14:45: D 2015-06-26 13:14:45: D Executing: su oracle -c 'touch /u01/app/oracle/product/12.1.0/dbhome_1/dbs/initCLONE02.ora' 2015-06-26 13:14:45: D Exit code: 0 2015-06-26 13:14:45: D Output of last command execution: 2015-06-26 13:14:45: I Activating clone database..... 2015-06-26 13:14:45: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/srvctl add database -d CLONE02 -o /u01/app/oracle/product/12.1.0/dbhome_1 -p "/acfs_snap/.ACFS/snaps/CLONE02/CLONE01/spfileCLONE02.ora" -s open' 2015-06-26 13:14:47: D Exit code: 0 2015-06-26 13:14:47: D Output of last command execution: 2015-06-26 13:14:47: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/srvctl modify database -d CLONE01 -spfile /acfs_snap/.ACFS/snaps/CLONE01/CLONE01/spfileCLONE01.ora' 2015-06-26 13:14:48: D Exit code: 0 2015-06-26 13:14:48: D Output of last command execution: 2015-06-26 13:14:48: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/srvctl start database -o nomount -d CLONE02' 2015-06-26 13:14:56: D Exit code: 0 2015-06-26 13:14:56: D Output of last command execution: 2015-06-26 13:14:56: D Executing: su oracle -c 'export ORACLE_SID=CLONE02; echo exit | /u01/app/oracle/product/12.1.0/dbhome_1/bin/sqlplus sys/welcome1 as sysdba @/var/log/gDBClone/ctrl.sql' SQL*Plus: Release 12.1.0.2.0 Production on Fri Jun 26 13:14:56 2015 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options SQL> SET FEEDBACK 1 SQL> SET NUMWIDTH 10 SQL> SET LINESIZE 80 SQL> SET TRIMSPOOL ON SQL> SET TAB OFF SQL> SET PAGESIZE 100 SQL> SQL> CREATE CONTROLFILE REUSE SET DATABASE CLONE02 RESETLOGS 2 MAXLOGFILES 16 3 MAXLOGMEMBERS 3 4 MAXINSTANCES 2 5 MAXLOGHISTORY 292 6 LOGFILE 7 GROUP 1 '/acfs_snap/.ACFS/snaps/CLONE02/CLONE01/onlinelog/CLONE01_log1.log' SIZE 512M BLOCKSIZE 512, 8 GROUP 2 '/acfs_snap/.ACFS/snaps/CLONE02/CLONE01/onlinelog/CLONE01_log2.log' SIZE 512M BLOCKSIZE 512, 9 GROUP 3 '/acfs_snap/.ACFS/snaps/CLONE02/CLONE01/onlinelog/CLONE01_log3.log' SIZE 512M BLOCKSIZE 512 10 DATAFILE 11 '/acfs_snap/.ACFS/snaps/CLONE02/CLONE01/datafile/o1_mf_sysaux_brt9z50o_.dbf', 12 '/acfs_snap/.ACFS/snaps/CLONE02/CLONE01/datafile/o1_mf_system_brt9z4rw_.dbf', 13 '/acfs_snap/.ACFS/snaps/CLONE02/CLONE01/datafile/o1_mf_undotbs1_brt9z9kf_.dbf', 14 '/acfs_snap/.ACFS/snaps/CLONE02/CLONE01/datafile/o1_mf_users_brtb0lg1_.dbf' 15 CHARACTER SET AL32UTF8; Control file created. SQL> alter database open resetlogs; Database altered. SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options 2015-06-26 13:15:36: D Exit code: 0 2015-06-26 13:15:36: D Executing: export ORACLE_SID=CLONE02; echo exit | /u01/app/oracle/product/12.1.0/dbhome_1/bin/sqlplus sys/welcome1 as sysdba @/var/log/gDBClone/tempTBS.sql SQL*Plus: Release 12.1.0.2.0 Production on Fri Jun 26 13:15:36 2015 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options Tablespace created. Database altered. Tablespace dropped. Tablespace altered. SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options 2015-06-26 13:15:37: D Exit code: 0 2015-06-26 13:15:37: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/srvctl modify database -d CLONE02 -z' 2015-06-26 13:15:38: D Exit code: 0 2015-06-26 13:15:39: I Successfully created clone "CLONE02" database 2015-06-26 13:15:39: D Executing: su oracle -c '/u01/app/oracle/product/12.1.0/dbhome_1/bin/lsnrctl stop listener_clone >/dev/null' 2015-06-26 13:15:39: D Exit code: 0
Validation of the SNAP
ps -ef|grep smon
oracle 2379 1 0 10:33 ? 00:00:01 asm_smon_+ASM oracle 2604 1 0 10:33 ? 00:00:00 ora_smon_db01 oracle 19318 1 0 13:14 ? 00:00:00 ora_smon_CLONE01 oracle 19879 1 0 13:14 ? 00:00:00 ora_smon_CLONE02 root 20393 2635 0 13:16 pts/0 00:00:00 grep smon
/u03/app/grid/product/12.1.0/grid/bin/crsctl status resource -w "TYPE = ora.database.type" -t
-------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.clone01.db 1 ONLINE ONLINE em12c Open,STABLE ora.clone02.db 1 ONLINE ONLINE em12c Open,STABLE ora.db01.db 1 ONLINE ONLINE em12c Open,STABLE --------------------------------------------------------------------------------
Query the ACFS CLONE/SNAP with gDBClone
gDBClone listdb -verbose
Database Name Database Type Database HomeLocation Database Version Database Role Location/Parent ------------- ------------- --------------------------------------- ---------------- ---------------- ---------------- CLONE02 SINGLE /u01/app/oracle/product/12.1.0/dbhome_1 Snapshot CLONE01 CLONE01 SINGLE /u01/app/oracle/product/12.1.0/dbhome_1 Master /acfs_snap/.ACFS/snaps/
gDBClone listdb -tree
Parent Child ------ ----- CLONE01 CLONE02
Delete a database with gDBClone
gDBClone deldb -tdbname clone02 -debug
You are going to drop the database CLONE02, are you sure (Y/N)? y Connecting to database 4% complete 9% complete 14% complete 19% complete 23% complete 28% complete 47% complete Updating network configuration files 48% complete 52% complete Deleting instance and datafiles 76% complete 100% complete Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/CLONE02.log" for further details. acfsutil snap delete: Snapshot operation is complete. ACFS snapshot CLONE02 on /acfs_snap ACFS file system has been deleted.
u03/app/grid/product/12.1.0/grid/bin/crsctl status resource -w "TYPE = ora.database.type" -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.clone01.db 1 ONLINE ONLINE em12c Open,STABLE ora.db01.db 1 ONLINE ONLINE em12c Open,STABLE --------------------------------------------------------------------------------
No comments:
Post a Comment