gDBClone “GOLD” image and Snapshot database creation

PSA: gDBClone utility is developed by Oracle (Ruggero Citton) to simplify database cloning for non-production instances leveraging ACFS snapshots feature.

Download gDBClone-3.0.2-92.noarch.rpm (as of 24Aug2018)

export PATH=$PATH:/opt/gDBClone
tree /opt/gDBClone/
/opt/gDBClone/
├── gDBClone
└── lib
├── gDBClone_AcfsUtils.pm
├── gDBClone_Clone.pm
├── gDBClone_DBConvert.pm
├── gDBClone_GetDBConnection.pm
├── gDBClone_Inventory.pm
├── gDBClone_LoggingAndTracing.pm
├── gDBClone_passwd.jar
├── gDBClone_PFile.pm
├── gDBClone_Queries.pm
├── gDBClone_Snap.pm
├── gDBClone_SqlUtils.pm
└── gDBClone_Utils.pm

odacli list-databases

Source database – FRODO
Target database (GOLD Image) – FROGOLD

odacli list-dbstorages

ID   Type DBUnique Name Status
b49a0525-b58c-4110-812e-18e1b4c90537 Acfs FRODO Configured

odacli describe-dbstorage -i b49a0525-b58c-4110-812e-18e1b4c90537

DBStorage details
----------------------------------------------------------------
                     ID: b49a0525-b58c-4110-812e-18e1b4c90537
                DB Name: FRODO
          DBUnique Name: FRODO
         DB Resource ID: 0751e9d7-6a49-45bb-a164-f78e09468fcb
           Storage Type: Acfs
          DATA Location: /u02/app/oracle/oradata/FRODO
          RECO Location: /u03/app/oracle/fast_recovery_area/
          REDO Location: /u04/app/oracle/redo/
   FLASH Cache Location:
                  State: ResourceState(status=Configured)
                Created: December 7, 2018 10:12:21 AM EST
            UpdatedTime: December 7, 2018 10:12:47 AM EST

export PATH=$PATH:/opt/gDBClone

gDBClone clone -sdbname FRODO.FQDN -sdbscan -sdbport -tdbname FROGOLD -tdbhome OraDB12102_home21 -tdbport _ -dataacfs /u02/app/oracle/oradata/FRODO -redoacfs /u04/app/oracle/redo/ -recoacfs /u03/app/oracle/fast_recovery_area/

INFO: 2018-12-07 10:27:42: Please check the logfile '/opt/gDBClone/out/log/gDBClone_34073.log' for more details
MacroStep1 - Getting information and validating setup...

Please enter the ‘SYS’ User password for the database FRODO.FQDN:
Please re-enter the ‘SYS’ user password for the database FRODO.FQDN:
INFO: 2018-12-07 10:27:51: Validating environment
INFO: 2018-12-07 10:27:51: Checking superuser usage
INFO: 2018-12-07 10:27:51: Checking if target database name ‘FROGOLD’ is a valid name
INFO: 2018-12-07 10:27:51: Checking if target database home ‘OraDB12102_home21’ exists
INFO: 2018-12-07 10:27:51: Checking if Oracle Restart
INFO: 2018-12-07 10:27:51: Checking ping to host ”
INFO: 2018-12-07 10:27:51: Getting ORACLE_BASE path from orabase
INFO: 2018-12-07 10:27:51: Checking if target database ‘FROGOLD’ exists
INFO: 2018-12-07 10:27:51: Checking ‘FROGOLD’ snapshot existence on ‘/u02/app/oracle/oradata/FRODO’
INFO: 2018-12-07 10:27:51: Checking registered instance ‘FROGOLD’
INFO: 2018-12-07 10:27:57: Checking listener on ‘:1521’
INFO: 2018-12-07 10:27:57: Checking ACFS command options
INFO: 2018-12-07 10:27:57: Checking if ‘/u02/app/oracle/oradata/FRODO’ is an ACFS file system
INFO: 2018-12-07 10:27:57: Checking if ‘/u04/app/oracle/redo/’ is an ACFS file system
INFO: 2018-12-07 10:27:57: Checking if ‘/u03/app/oracle/fast_recovery_area/’ is an ACFS file system
INFO: 2018-12-07 10:27:59: Checking source and target database version
INFO: 2018-12-07 10:27:59: Checking source database size
INFO: 2018-12-07 10:27:59: Checking source database role
INFO: 2018-12-07 10:27:59: Checking source log mode
INFO: 2018-12-07 10:28:00: Checking Flash Cache setting
SUCCESS: 2018-12-07 10:28:00: Environment validation complete

MacroStep2 – Setting up clone environment…
INFO: 2018-12-07 10:28:00: Creating local pfile
INFO: 2018-12-07 10:28:00: Creating local password file
INFO: 2018-12-07 10:28:00: Creating local Audit folder
INFO: 2018-12-07 10:28:00: Creating local auxiliary listener
INFO: 2018-12-07 10:28:00: Starting auxiliary listener
INFO: 2018-12-07 10:28:00: Sleeping 60 secs, please wait
INFO: 2018-12-07 10:29:00: Setting up ACFS storage
INFO: 2018-12-07 10:29:00: Creating dynamic scripts
INFO: 2018-12-07 10:29:02: Cloning to target ACFS from host ”
INFO: 2018-12-07 10:29:02: Creating RMAN script for spfile target to ACFS
INFO: 2018-12-07 10:29:02: Instantiating clone database
SUCCESS: 2018-12-07 10:29:02: Environment setup complete

MacroStep3 – Cloning database ‘FRODO.FQDN’…
INFO: 2018-12-07 10:29:02: Getting cluster_interconnects values on ‘FRODO.FQDN’
INFO: 2018-12-07 10:29:03: Database clone in progress, please wait
INFO: 2018-12-07 10:29:03:    (this can take a while depending on database size and/or network speed)
INFO: 2018-12-07 10:31:04: Cloned database restore until SCN:1069603 done successfully
INFO: 2018-12-07 10:31:04: Moving spfile
INFO: 2018-12-07 10:31:26: Register ‘FROGOLD’ database as cluster resource
INFO: 2018-12-07 10:31:28: Updating spfile
INFO: 2018-12-07 10:31:34: Updating local pfile
INFO: 2018-12-07 10:31:34: Checking database name
INFO: 2018-12-07 10:31:34: Modifying DB instance
INFO: 2018-12-07 10:31:35: Setup ACFS dependency
WARNING: 2018-12-07 10:31:39: Copy ‘/u01/app/oracle/product/12.1.0.2/dbhome_21/network/admin/tnsnames.ora’ to remote node ” failed
SUCCESS: 2018-12-07 10:31:39: Clone database ‘FROGOLD’ created successfully
INFO: 2018-12-07 10:31:39: Starting database ‘FROGOLD’
SUCCESS: 2018-12-07 10:31:54: Successfully created clone database ‘FROGOLD’

gDBClone listdbs

Database Name Database Type Database Role Master/Snapshot  Location/Parent
FRODO RACOneNode PRIMARY Master /u02/app/oracle/oradata
FROGOLD SINGLE PRIMARY Master /u02/app/oracle/oradata/FRODO/.ACFS/snaps/

If you tried to created a snapshot database FROSNAP using FRODO, it willl error out

gDBClone snap -sdbname FRODO -tdbname FROSNAP -tdbhome OraDB12102_home21

INFO: 2018-12-07 11:07:35: Please check the logfile '/opt/gDBClone/out/log/gDBClone_47651.log' for more details

MacroStep1 - Getting information and validating setup...

Please enter the ‘SYS’ User password for the database FRODO:
Please re-enter the ‘SYS’ user password for the database FRODO:
INFO: 2018-12-07 11:07:42: Validating environment…
INFO: 2018-12-07 11:07:42: Superuser usage check
INFO: 2018-12-07 11:07:42: Clusterware running check
INFO: 2018-12-07 11:07:43: Oracle Restart check
INFO: 2018-12-07 11:07:43: Minimum crs activeversion check
INFO: 2018-12-07 11:07:43: Database ‘FRODO’ existence check
INFO: 2018-12-07 11:07:43: Database ‘FRODO’ running check
INFO: 2018-12-07 11:07:44: Checking if target database home ‘OraDB12102_home21’ exists
INFO: 2018-12-07 11:07:45: Getting ORACLE_BASE path from orabase
INFO: 2018-12-07 11:07:45: Checking if target database name FROSNAP is a valid name
INFO: 2018-12-07 11:07:45: Checking database ‘FRODO’ connectivity
INFO: 2018-12-07 11:07:54: Checking whether the database ‘FRODO’ is in ACFS snapshot
ERROR: 2018-12-07 11:07:54:
ERROR: 2018-12-07 11:07:54: Given source database ‘FRODO’ is not a SNAP database

Because FRODO is not a “SNAP” database, I.E it wasn’t created using “gDBClone clone”

gDBClone snap -sdbname FROGOLD -tdbname FROSNAP -tdbhome OraDB12102_home21

INFO: 2018-12-07 11:14:32: Please check the logfile '/opt/gDBClone/out/log/gDBClone_67072.log' for more details
MacroStep1 - Getting information and validating setup...
Please enter the 'SYS' User password for the database FROGOLD:
Please re-enter the 'SYS' user password for the database FROGOLD:
Given passwords are not matching
Please re-enter the password
Please enter the 'SYS' User password for the database FROGOLD:
Please re-enter the 'SYS' user password for the database FROGOLD:
INFO: 2018-12-07 11:14:46: Validating environment...
INFO: 2018-12-07 11:14:46: Superuser usage check
INFO: 2018-12-07 11:14:46: Clusterware running check
INFO: 2018-12-07 11:14:46: Oracle Restart check
INFO: 2018-12-07 11:14:46: Minimum crs activeversion check
INFO: 2018-12-07 11:14:46: Database 'FROGOLD' existence check
INFO: 2018-12-07 11:14:46: Database 'FROGOLD' running check
INFO: 2018-12-07 11:14:48: Checking if target database home 'OraDB12102_home21' exists
INFO: 2018-12-07 11:14:48: Getting ORACLE_BASE path from orabase
INFO: 2018-12-07 11:14:48: Checking if target database name FROSNAP is a valid name
INFO: 2018-12-07 11:14:48: Checking database 'FROGOLD' connectivity
INFO: 2018-12-07 11:15:00: Checking whether the database 'FROGOLD' is in ACFS snapshot
INFO: 2018-12-07 11:15:00: Checking source database 'FROGOLD' and target dbhome version
INFO: 2018-12-07 11:15:04: Checking if target database 'FROSNAP' exists
INFO: 2018-12-07 11:15:04: Checking registered instance 'FROSNAP'
INFO: 2018-12-07 11:15:11: Checking if FROSNAP exists as snapshot in '/u02/app/oracle/oradata/FRODO'
INFO: 2018-12-07 11:15:11: Checking if source database FROGOLD is snapable
INFO: 2018-12-07 11:15:17: ...Checking whether the database 'FROGOLD' is entirely on ACFS
INFO: 2018-12-07 11:15:23: ...Checking whether the database 'FROGOLD' is a primary/physical standby database.
INFO: 2018-12-07 11:15:26: ...Checking whether the database 'FROGOLD' is in READ WRITE mode
INFO: 2018-12-07 11:15:32: ...Checking whether the database 'FROGOLD' is a CDB
INFO: 2018-12-07 11:15:44: ...Checking whether the database 'FROGOLD' is running as backup mode
INFO: 2018-12-07 11:15:50: ...Checking whether the database 'FROGOLD' is running in archivelog mode
INFO: 2018-12-07 11:15:56: ...Checking if all datafiles are available
INFO: 2018-12-07 11:16:02: ...Checking if there are OFFLINE datafiles
SUCCESS: 2018-12-07 11:16:07: Environment validation complete
MacroStep2 - Getting database snapshot...
INFO: 2018-12-07 11:16:07: Cloning source database 'FROGOLD' using ACFS snapshot
INFO: 2018-12-07 11:16:31: Entering into SNAP database creation phase 1
INFO: 2018-12-07 11:16:31: ...Getting required information to get consistent database snapshot
WARNING: 2018-12-07 11:16:43: Do not perform any Structural change to database 'FROGOLD' till snapshot database 'FROSNAP' is created
INFO: 2018-12-07 11:16:56: ...Getting the snapshot of Database 'FROGOLD' at this time
INFO: 2018-12-07 11:16:56: ...Successfully took the snapshot 'FROSNAP' of database 'FROGOLD' on '/u02/app/oracle/oradata/FRODO'
INFO: 2018-12-07 11:17:03: ...Setting up storage for SNAP Database 'FROSNAP'
INFO: 2018-12-07 11:17:31: Entering into SNAP database creation phase 2
INFO: 2018-12-07 11:17:31: ...Creating controlfile for database 'FROSNAP'
INFO: 2018-12-07 11:17:49: ...Recovering the database: FROSNAP, snapshot time : '2018-12-07:11:16:56', until 'change:1074448'
INFO: 2018-12-07 11:17:50: ...Opening the database with resetlogs
INFO: 2018-12-07 11:18:01: ...Setting the temporary tablespace for database 'FROSNAP'
INFO: 2018-12-07 11:18:31: ...Changing the Database ID
INFO: 2018-12-07 11:19:24: ...Creating spfile for 'FROSNAP'
INFO: 2018-12-07 11:19:26: ...Creating password file for FROSNAP
INFO: 2018-12-07 11:19:26: Entering into SNAP database creation phase 3
INFO: 2018-12-07 11:19:46: ...Successfully started the database
INFO: 2018-12-07 11:19:53: ...Setting RMAN SNAPSHOT control file
INFO: 2018-12-07 11:20:00: ...Disabling the external references in the database 'FROSNAP' inherited from 'FROGOLD'
------------------------------------------------------------------------------
Run on the database 'FROSNAP' the SQL script:
 '/u01/app/oracle/product/12.1.0.2/dbhome_21/enable_external_refs_FROSNAP_VZq8.sql'
to enable these external references.
Also need to restart the database after running the SQL script.
------------------------------------------------------------------------------
INFO: 2018-12-07 11:20:59: Setup ACFS dependency
WARNING: 2018-12-07 11:21:07: Copy '/u01/app/oracle/product/12.1.0.2/dbhome_21/network/admin/tnsnames.ora' to remote node '<host1>' failed
SUCCESS: 2018-12-07 11:21:07: Snapshot database 'FROSNAP' created successfully
INFO: 2018-12-07 11:21:07: Starting database 'FROSNAP'
SUCCESS: 2018-12-07 11:21:08: Successfully started clone database 'FROSNAP'

gDBClone listdbs

Database Name Database Type Database Role Master/Snapshot  Location/Parent
FRODO RACOneNode PRIMARY Master /u02/app/oracle/oradata
FROGOLD SINGLE PRIMARY Master /u02/app/oracle/oradata/FRODO/.ACFS/snaps/
FROSNAP SINGLE PRIMARY Snapshot FROGOLD

gDBClone listsnaps -dataacfs /u02/app/oracle/oradata/FRODO/

snapshot name:               FROGOLD
snapshot location:           /u02/app/oracle/oradata/FRODO/.ACFS/snaps/FROGOLD
RO snapshot or RW snapshot:  RW
parent name:                 /u02/app/oracle/oradata/FRODO/
snapshot creation time:      Fri Dec  7 10:29:00 2018
storage added to snapshot:   1774829568   (   1.65 GB )

snapshot name:               FROSNAP
snapshot location:           /u02/app/oracle/oradata/FRODO/.ACFS/snaps/FROSNAP
RO snapshot or RW snapshot:  RW
parent name:                 FROGOLD
snapshot creation time:      Fri Dec  7 11:16:56 2018
storage added to snapshot:   119156736   ( 113.64 MB )

number of snapshots:  2
snapshot space usage: 1942614016  (   1.81 GB )

You can create multiple snapshot databases from “GOLD Image” FROGOLD database.

srvctl config database -d FROGOLD

Database unique name: FROGOLD
Database name:
Oracle home: /u01/app/oracle/product/12.1.0.2/dbhome_21
Oracle user: oracle
Spfile: /u02/app/oracle/oradata/FRODO/.ACFS/snaps/FROGOLD/FROGOLD/spfileFROGOLD.ora
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups:
Mount point paths: /u02/app/oracle/oradata/FRODO,/u04/app/oracle/redo/,/u03/app/oracle/
Services:
Type: SINGLE
OSDBA group: dba
OSOPER group: dba
Database instance: FROGOLD
Configured nodes: host0
Database is administrator managed

srvctl config database -d FROSNAP

Database unique name: FROSNAP
Database name:
Oracle home: /u01/app/oracle/product/12.1.0.2/dbhome_21
Oracle user: oracle
Spfile: /u02/app/oracle/oradata/FRODO/.ACFS/snaps/FROSNAP/FROSNAP/spfileFROSNAP.ora
Password file: /u02/app/oracle/oradata/FRODO/.ACFS/snaps/FROSNAP/FROSNAP/orapwFROSNAP
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups:
Mount point paths: /u02/app/oracle/oradata/FRODO,/u04/app/oracle/redo/,/u03/app/oracle/
Services:
Type: SINGLE
OSDBA group: dba
OSOPER group: dba
Database instance: FROSNAP
Configured nodes: host0
Database is administrator managed

If you are on Oracle Database Appliance, there is one down side to gDBClone databases. ODA management layer (odacli) isn’t aware of the existence of these databases.

Leave a comment