Creating a snapplan (db2ed_vmchecksnap)
The db2ed_vmchecksnap command creates a snapplan that db2ed_vmsnap uses to create a snapshot of a DB2 database. The snapplan specifies snapshot scenarios (such as online_snapshot, online_mirror, or offline).
You can name a snapplan file whatever you choose. Each entry in the snapplan file is a line in parameter=argument format.
Table: Parameter values for db2ed_vmchecksnap shows which parameters are set when using db2ed_vmchecksnap to create or validate a snapplan.
Table: Parameter values for db2ed_vmchecksnap
Parameter
|
Value |
SNAPSHOT_VERSION
|
Specifies the snapshot version for this major release
of Veritas Storage Foundation for DB2. |
PRIMARY_HOST
|
The name of the host where the primary database resides. |
SECONDARY_HOST
|
The name of the host where the database will be imported. |
PRIMARY_DG
|
The name of the VxVM disk group used by the primary
database. |
SNAPSHOT_DG
|
The name of the disk group containing the snapshot
volumes.
The snapshot volumes will be put into this disk group
on the primary host and deported. The secondary host can import this disk
group to start a clone database.
|
DB2DATABASE
|
The name of the DB2 database. |
DB2HOME
|
The home directory of the database. |
REDOLOG_DEST
|
The full path of the redo logs. |
SNAPSHOT_MODE
|
offline or online_snapshot or online_mirror
Specifies whether
the database should be offline, online_snapshot, or online_mirror when
the snapshot is created. By default, the SNAPSHOT_MODE is online_snapshot.
If the snapshot is created while the SNAPSHOT_MODE for
the database is set to online_snapshot or online_mirror, the db2ed_vmsnap command will first put the database
into WRITE SUSPEND mode.
After db2ed_vmsnap finishes creating the snapshot, it will
take the database out of WRITE SUSPEND mode.
If the database is offline, it is not necessary to put the database into WRITE
SUSPEND mode.
If the SNAPSHOT_MODE is offline, the secondary host must be different than the primary
host.
If the SNAPSHOT_MODE is online_mirror, the primary and secondary host must be the same, and the ALLOW_REVERSE_RESYNC parameter
must be set to yes in the snapplan. If the SNAPSHOT_MODE is online_snapshot, the clone can be created on either the primary
or a secondary host.
|
SNAPSHOT_PLAN_FOR
|
The default value is database and
cannot be changed. |
SNAPSHOT_PLEX_TAG
|
Specifies the snapshot plex tag.
Use this variable to specify a tag for the plexes to be snapshot. The maximum
length of the plex_tag is 15 characters. |
SNAPSHOT_MIRROR
|
Specifies the number of mirrors that will be part
of the snapshot. The default value is 1. |
SNAPSHOT_VOL_PREFIX
|
Specifies the snapshot volume prefix. Use this variable
to specify a prefix for the snapshot volumes split from the primary disk group.
A volume name cannot be more than 32 characters. You should consider the length
of the volume name when assigning the prefix. |
ALLOW_REVERSE_RESYNC
|
yes or no
By
default, reverse resynchronization is off (set equal to no)
with the SNAPSHOT_MODE
set to online_snapshot.
If the SNAPSHOT_MODE
is online_mirror,
reverse resynchronization is set equal to yes.
If ALLOW_REVERSE_RESYNC
is set to yes,
data from the snapshot volume can be used to overwrite the primary volume.
|
When you first run db2ed_vmchecksnap, use the -o setdefaults option to create a snapplan using default values for variables. You may then edit the file manually to set the variables for different snapshot scenarios.
Before creating a snapplan, make sure the following conditions have been met:
To create a snapplan
-
Change directories to the working directory you want to store your snapplan in.
$ cd /working_directory
-
Create a snapplan with default values using the db2ed_vmchecksnap command:
$ /opt/VRTS/bin/db2ed_vmchecksnap -D DB2DATABASE \
-f SNAPPLAN -o setdefaults -t host_name -p PLEX_TAG
-
Open the snapplan file in a text editor and modify it as needed.
Note: |
The default setting for SNAPSHOT_MODE is online_snapshot. |
In this example, a snapplan, snap1, is created for a snapshot image in a single-host configuration and default values are set. The host is named host1 and the working directory is /export/snap_dir.
$ cd /export/snap_dir
$ /opt/VRTS/bin/db2ed_vmchecksnap -D PROD -f snap1 -o setdefaults \
-t host1 -p PRODtag
Snapplan snap1 for PROD.
=====================================================
SNAPSHOT_VERSION=5.0
PRIMARY_HOST=host1
SECONDARY_HOST=host1
PRIMARY_DG=PRODdg
SNAPSHOT_DG=SNAP_PRODdg
DB2DATABASE=PROD
DB2HOME=/PROD_HOME
REDOLOG_DEST=/PROD_HOME/inst1/NODE0000/SQL00001/SQLOGDIR/
SNAPSHOT_MODE=online_snapshot
SNAPSHOT_PLAN_FOR=database
SNAPSHOT_PLEX_TAG=PRODtag
SNAPSHOT_MIRROR=1
SNAPSHOT_VOL_PREFIX=SNAP_
ALLOW_REVERSE_RESYNC=no
In this example, a snapplan, snap2, is created for a snapshot image in a two-host configuration, and default values are set. The primary host is host1, the secondary host is host2, and the working directory is /export/snap_dir.
$ cd /export/snap_dir
$ /opt/VRTS/bin/db2ed_vmchecksnap -D PROD -f snap2 -o setdefaults \
-p PRODtag -t host2
Snapplan snap2 for PROD.
=====================================================
SNAPSHOT_VERSION=5.0
PRIMARY_HOST=host1
SECONDARY_HOST=host2
PRIMARY_DG=PRODdg
SNAPSHOT_DG=SNAP_PRODdg
DB2DATABASE=PROD
DB2HOME=/PROD_HOME
REDOLOG_DEST=/PROD_HOME/inst1/NODE0000/SQL00001/SQLOGDIR/
SNAPSHOT_MODE=online_snapshot
SNAPSHOT_PLAN_FOR=database
SNAPSHOT_PLEX_TAG=PRODtag
SNAPSHOT_MIRROR=1
SNAPSHOT_VOL_PREFIX=SNAP_
ALLOW_REVERSE_RESYNC=no
SNAPSHOT_MIRROR=1