Summary of database snapshot steps

You can use Database FlashSnap commands to create a snapshot of your entire database on the same host or on a different one. Three types of snapshots can be created: online_snapshot, online_mirror, or offline.

If the SNAPSHOT_MODE specified in the snapplan is set to online_snapshot, db2ed_vmsnap first puts the database into WRITESUSPEND mode. After the database is in WRITESUSPEND mode, the snapshot volumes are created by breaking off the mirrors and splitting the snapshot volumes into a separate disk group. The split disk group will have the prefix specified in the snapplan. The database is taken out of WRITESUSPEND mode using the write resume command.

You can run the db2ed_vmclonedb command on the secondary host to import the disk group and create a clone database. You can run the db2ed_vmsnap command to synchronize the snapshot volumes with the primary database. The snapshot volumes can also be used to restore the primary database if it becomes corrupted. In this case, the ALLOW_REVERSE_RESYNC parameter must be set to yes in the snapplan.

If the SNAPSHOT_MODE is set to online_mirror, then db2ed_vmsnap puts the database into WRITESUSPEND mode. The snapshot volumes are created by breaking off the mirrors and splitting the snapshot volumes into a separate disk group. The split disk group has the prefix specified in the snapplan. The database is taken out of WRITESUSPEND mode using the write resume command. The database snapshot can be used to restore the primary database if it becomes corrupted.

If the SNAPSHOT_MODE is set to offline, the database must be inactive before the snapshot is created. The secondary host must be different than the primary host. Since the database is inactive, no active logs exist.

online_snapshot, online_mirror, and offline snapshots provide a valid backup image of the database. You can use the snapshot as a source for backing up the database or creating a clone database (only for online_snapshot or offline) for decision-support purposes.

By using Database FlashSnap commands, you can create snapshots of all volumes on a database using the snapplan. Optionally, you can use the VxVM command (vxsnap) to create volume snapshots. However, unlike the Database FlashSnap commands, the vxsnap command does not automate disk group content reorganization functions.

For more information about the vxsnap command, see Veritas Volume Manager Administrator's Guide.

Note:

Make sure the volumes used by the database are configured properly before attempting to take a snapshot. This requires superuser (root) privileges.

Anytime you change the structure of the database (for example, by adding or deleting containers), you must run db2ed_update.

Database FlashSnap commands must be run by the DB2 instance owner.

To create a snapshot image of a database

  1. Create a snapshot mirror of a volume or volume set.

    See Creating a snapshot mirror of a volume or volume set used by the database.

  2. Use the db2ed_vmchecksnap command to create a snapplan template and check the volume configuration to ensure that it is valid for creating volume snapshots of the database.

    The snapplan contains detailed database and volume configuration information that is needed for snapshot creation and resynchronization. You can modify the snapplan template with a text editor.

    The db2ed_vmchecksnap command can also be used to:

    • List all snapplans associated with a specific DB2DATABASE (db2ed_vmchecksnap -o list).

    • Remove the snapplan from the repository (db2ed_vmchecksnap -o remove -f SNAPPLAN).

    • Copy a snapplan from the repository to your local directory (db2ed_vmchecksnap -o copy -f SNAPPLAN).

  3. Use the command to create snapshot volumes for the database.

  4. On the secondary host, use the db2ed_vmclonedb command to create a clone database using the disk group deported from the primary host.

    The db2ed_vmclonedb command imports the disk group that was deported from the primary host, recovers the snapshot volumes, mounts the file systems, recovers the database, and brings the database online. If the secondary host is different, the database name can be same. You can use the -o recoverdb option to let db2ed_vmclonedb perform an automatic database recovery, or you can use the -o mount option to perform your own point-in-time recovery and bring up the database manually. For a point-in-time recovery, the snapshot mode must be online_snapshot.

    You can also create a clone on the primary host. Your snapplan settings specify whether a clone should be created on the primary or secondary host.

  5. You can now use the clone database to perform database backup and other off-host processing work.

  6. The clone database can be used to reverse resynchronize the original volume from the data in the snapshot, or can be discarded by rejoining the snapshot volumes with the original volumes (that is, by resynchronizing the snapshot volumes) for future use.

Figure: Prerequisites for creating a snapshot of your database depicts the sequence of steps leading up to taking a snapshot using Database FlashSnap.

Figure: Prerequisites for creating a snapshot of your database

Prerequisites for creating a snapshot of your database

There are many actions you can take after creating a snapshot of your database using Database FlashSnap. You can create a clone of the database for backup and off-host processing purposes. You can resynchronize the snapshot volumes with the primary database. In the event of primary database failure, you can recover it by reverse resynchronizing the snapshot volumes.

Figure: Actions you can perform if the SNAPSHOT_MODE is set to online_snapshot or offline

Actions you can perform if the SNAPSHOT_MODE is set to online_snapshot or offline

Figure: Actions you can perform if the SNAPSHOT_MODE is set to online_mirror

Actions you can perform if the SNAPSHOT_MODE is set to online_mirror