Creating a snapshot (db2ed_vmsnap)

The db2ed_vmsnap command creates a snapshot of a DB2 database by splitting the mirror volumes used by the database into a snapshot database. You can use the snapshot image on either the same host as the database or on a secondary host provided storage is shared by the two hosts.

The snapshot image created by db2ed_vmsnap is a frozen image of a DB2 database's containers.

Before creating a snapshot, make the sure the following conditions are met:

Prerequisites

  • You must be logged in as the DB2 instance owner.

  • You must create and validate a snapplan using db2ed_vmchecksnap before you can create a snapshot image with db2ed_vmsnap.

Usage notes

  • The db2ed_vmsnap command can only be used on the primary host.

  • When creating a snapshot volume, create the snapshot on a separate controller and on separate disks from the primary volume.

  • The online redo log must be included in the snapshot if a clone database is to be started.

  • Resynchronization speed varies based on the amount of data changed in both the primary and secondary volumes when the mirror is broken off.

  • See the db2ed_vmsnap(1M) manual page for more information.

To create a snapshot

  1. If SNAPSHOT_MODE is set to offline in the snapplan, terminate all connections to the database.

  2. Create the snapshot image using the db2ed_vmsnap command:

    $ /opt/VRTS/bin/db2ed_vmsnap -D DB2DATABASE -f SNAPPLAN \		
     -o snapshot [-F]

Note:

To force snapshot creation, use the -F option. The -F option can be used after a snapshot operation has failed and the problem was fixed without using Veritas Storage Foundation for DB2 commands. (That is, the volumes were synchronized without using Veritas Storage Foundation for DB2 commands.) In this situation, the status of the snapplan will appear as unavailable for creating a snapshot. The -F option ignores the unavailable status, checks for the availability of volumes, and creates the snapshot after the volumes pass the availability check.

After the snapshot is created, dbed_vmsnap returns values you will need to run db2ed_vmclonedb. These values include the snapshot disk group, the snapplan name, and the primary database server name (server_name). Make a note of these values so you have them when running db2ed_vmclonedb. You can also use the command db2ed_vmchecksnap -f snapplan -o list to access the information regarding the snapshot disk group.

The snapshot volumes now represent a consistent backup copy of the database. You can back up the database by copying the snapshot volumes to tape or other backup media.

See Backing up the database from snapshot volumes (db2ed_vmclonedb).

You can also create another DB2 database for decision-support purposes.

See Cloning a database (db2ed_vmclonedb).

In this example, a snapshot image of the database, PROD, is created for a single-host configuration. In this case, the SECONDARY_HOST parameter is set the same as the PRIMARY_HOST parameter in the snapplan.

$ /opt/VRTS/bin/db2ed_vmsnap -D PROD -f snap1 -o snapshot
db2ed_vmsnap started at 2006-03-10 13:10:54
DB20000I  The SET WRITE command completed successfully.
DB20000I  The SET WRITE command completed successfully.
A snapshot of DB2DATABASE PROD is in DG SNAP_PRODdg.
Snapplan snap1 is used for the snapshot.
DB2 server (server_name) is kagu

If -r <relocate_path> is used in db2ed_vmclonedb,
        make sure <relocate_path> is created and owned by 
        DB2 Instance Owner.
        Otherwise, the following mount points need to be
        created and owned by DB2 Instance Owner:

        /PROD_HOME.
        /PROD_TBS.

db2ed_vmsnap ended at 2006-03-10 13:11:17

In this example, a snapshot image of the primary database, PROD, is created for a two-host configuration. In this case, the SECONDARY_HOST parameter specifies a different host name than the PRIMARY_HOST parameter in the snapplan.

$ /opt/VRTS/bin/db2ed_vmsnap -D PROD -f snap2 -o snapshot
db2ed_vmsnap started at 2006-03-10 13:13:53
DB20000I  The SET WRITE command completed successfully.
DB20000I  The SET WRITE command completed successfully.
A snapshot of DB2DATABASE PROD is in DG SNAP_PRODdg.
Snapplan snap2 is used for the snapshot.
DB2 server (server_name) is kagu

If -r <relocate_path> is used in db2ed_vmclonedb,
        make sure <relocate_path> is created and owned by 
        DB2 Instance Owner.
        Otherwise, the following mount points need to be
        created and owned by DB2 Instance Owner:

        /PROD_HOME.
        /PROD_TBS.

db2ed_vmsnap ended at 2006-03-10 13:14:16