Creating a clone of a database by using Database FlashSnap

You can use Database FlashSnap to create a clone of a database by performing the steps outlined in Figure: Creating a Clone - Workflow .

Figure: Creating a Clone - Workflow

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

  1. Create a configuration file.
    $ /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.

    Note:

    If you have exported in environment the DB2INSTANCE and DB2DATABASE parameters, you do not need to include them on the command line. In the following steps, it is assumed that DB2INSTANCE and DB2DATABASE are available from the environment.

  2. Validate the setup.
    $ /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.

  3. Create a snapshot of the database.
    $ /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.

  4. Mount the snapshot.
    $ /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.

    Note:

    Ensure that the DB2 user has the required permissions to create the /clonedb2 directory, if it does not exist.

  5. Clone the database based on the snapshot.
    $ /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.

    Note:

    If you have already specified the clone_name and the clone_path parameters in the configuration file that was used during the validate operation, the clone_name parameter is not required on the command line.

More Information

vxsfadm command reference

FlashSnap configuration parameters

FlashSnap supported operations