You can use Database FlashSnap to create a clone of a database by performing the steps outlined in Figure: Creating a Clone - Workflow .
For details, refer to vxsfadm-flashsnap(1M) and vxsfadm-db2-flashsnap(1M) man pages.
To create a clone of a DB2 database by using FlashSnap
$ /opt/VRTS/bin/vxsfadm -s flashsnap \ -a db2 -o setdefaults --db2instance db2inst1 \ --db2database proddb --flashsnap_name daily_snap -c dailyconfig Written config file dailyconfig
This command creates a default configuration file with all the parameters and default values. You can change the parameters, if required.
$ /opt/VRTS/bin/vxsfadm -s flashsnap \ -a db2 -o validate -c dailyconfig Validating database configuration for third-mirror-break-off snapshot: DB2INSTANCE = db2inst1 DB2DATABASE = proddb APP_MODE = online SNAPSHOT_ARCHIVE_LOG = auto ARCHIVELOG_DEST = /db2arch/ Database validation successful. Validating database volume layout for third-mirror-break-off snapshot: Data volumes ready for snapshot: Volume/volume-set db2datavol of diskgroup db2dg mounted on /db2data. Archivelog volume ready for snapshot: Volume/volume-set db2archvol of diskgroup db2dg mounted on /db2arch. Storage units to be used for snapshot from diskgroup db2dg: ds4100-0_9 ds4100-0_7 SNAPSHOT_VOL_PREFIX = SNAP_ SNAPSHOT_DG_PREFIX = SNAP_ Database volume layout validated successfully.
This command validates the configuration file and the database environment. In case of any problem, appropriate error messages are displayed that you can use to correct the problem and then retry.
$ /opt/VRTS/bin/vxsfadm -s flashsnap \ -a db2 -o snap -c dailyconfig Validating database configuration for third-mirror-break-off snapshot: DB2INSTANCE = db2inst1 DB2DATABASE = proddb APP_MODE = online SNAPSHOT_ARCHIVE_LOG = auto ARCHIVELOG_DEST = /db2arch/ Database validation successful. snapshot started at Tue Mar 20 00:39:41 2012. Putting database in write-suspend mode... Done Validating database volume layout for third-mirror-break-off snapshot: Data volumes ready for snapshot: Volume/volume-set db2datavol of diskgroup db2dg mounted on /db2data. Archivelog volume ready for snapshot: Volume/volume-set db2archvol of diskgroup db2dg mounted on /db2arch. Storage units to be used for snapshot from diskgroup db2dg: ds4100-0_9 ds4100-0_7 SNAPSHOT_VOL_PREFIX = SNAP_ SNAPSHOT_DG_PREFIX = SNAP_ Database volume layout validated successfully. Creating snapshot volumes for data volumes ... Done Taking database out of write-suspend mode... Done Creating snapshot volume for archivelog volume ... Done Copying snapshot information to snapshot volume ... Done Creating snapshot diskgroups ... Done Deporting snapshot diskgroups ... Done SNAP_db2dg snaphot ended at Tue Mar 20 00:40:23 2012.
This command breaks the user-specified mirror ( parameter SNAPSHOT_PLEX_TAG ) from the primary volumes and creates a new disk group with the name starting with the string defined in the snap_dg_prefix parameter. The default value of this parameter is SNAP_.
Note: |
At the validation stage, all the parameters, including the mandatory parameters --db2instance, --db2database, and --flashsnap_name, are read and stored in the repository. |
If you need to change any parameter, change the configuration file and specify it with the -c option.
$ /opt/VRTS/bin/vxsfadm -s flashsnap \ -a db2 -o mount -c dailyconfig Retrieving snapshot information ... Done Importing snapshot diskgroups ... Done Mounting snapshot volumes ... Done
Note: |
This command mounts the snapshot on the host running the DB2 instance. The secondary host is the system defined in the SECONDARY_HOST parameter of the configuration file. |
By default, volumes are mounted under the /var/tmp
file system.
If you need to specify an alternate location for mounting snapshot volumes, either provide CLONE_PATH on the command line or from the configuration file.
For performing off-host operations, specify the SFDB repository host using the -r option of the vxsfadm command.
$ /opt/VRTS/bin/vxsfadm -s flashsnap \ -a db2 -o clone -c dailyconfig Retrieving snapshot information ... Done Importing snapshot diskgroups ... Done Mounting snapshot volumes ... Done Relocating/ Renaming clone database clone1 ... Done Initializing clone database clone1 ... Done Activating clone database clone1 ... Done
If you have not specified clone_name, it is automatically generated.