Flashsnap - Third mirror break-off snapshots using vxsfadm
vxsfadm -s flashsnap -a db2 --db2database <database name> --flashsnap_name <config_name> -o <operation> [ --config_param <value> ... ]vxsfadm -s flashsnap -a db2 -c <config_file> -o <operation> [ --config_param <value> ... ]
Veritas Database FlashSnap helps to create a point-in-time copy of a database for backup and off-host processing. Database FlashSnap lets you make backup copies of your volumes online and with minimal interruption to users.Database FlashSnap lets you capture an online image of an actively changing database at a given instant that is known as a snapshot. A snapshot copy of the database is referred to as a database snapshot. You can use a database snapshot on the same host as the production database or on a secondary host sharing the same storage.A database snapshot can be used for off-host processing applications, such as backup, data warehousing, and decision-support queries. When the snapshot is no longer needed, the database administrator can import the original snapshot back to the primary host and resynchronize the snapshot to the original database volumes. Database FlashSnap commands are executed from the command line interface.
Flashsnap service provides traditional volume level Snapshot (Third mirror break-off, full sized snapshot)
Traditional snapshot creates a full size, volume-level snapshot image of an volume, by splitting the mirror volumes. One can use the snapshot image on either the same host where the application is running or on a secondary host, provided storage is shared by the two hosts.
Flashsnap service is supported on local mount and CFS mounts. User needs to tag a mirror which needs to be split. At the time of splitting the mirror, all the i/o to the volume would be frozen to get a consistent image of the volume. Splitting of mirror is a automic operation and is done in a fraction of a second.
SETDEFAULTS Generates the default configuration file for application. VALID | VALIDATE Validates the configuration file and environment. SNAP | SNAPSHOT | BREAK Breaks the mirror and splits the disk group. MOUNT | SNAPMOUNT Mounts the Mirror volumes on specified mount point (See configuration parameter CLONE_PATH). If the mount location is not specified, it will mount the snapshot in /tmp. UNMOUNT | UMOUNT | SNAPUNMOUNT Umounts the snapshots, if clone is created, would shutdown the clone. CLONE | CLONEDB Clone the database to a new database. New database can be named using parameter CLONE_NAME. If no name is specified, a default name for the clone will be generated. RESYNC Resyncs the mirror with primary volumes. LIST Lists available snapshot configurations. DESTROY Destroys the flashsnap configuration from the repository
Configuration parameters allow users to control snapshot operation. Almost all of the configuration parameters are optional (with the exception of application instance name and configuration name). Parameters can be specified in a configuration file (using -c <configfile> option of vxsfadm) or as command-line arguments (command line option) to vxsfadm. Following is the list of parameters for DB2 database snapshot service.
Description User-defined name of the snapshot configuration. This name is used for referring a particular snapshot for performing any operation. It is also used in listing snapshots (vxsfadm -o list option). Valid Values Character string. Ex. snap1. This parameter is not optional. Command line option --flashsnap_name <value> or --name <value>
Description Version of snapplan or snapshot configuration. Valid Values <number>.<number> Ex. 6.0 Command line option none
Description The DB2 instance name . Valid Values Character string. Ex. db2inst1. This parameter is not optional. It can be specified as environment variable. Command line option --db2instance <value> or -I <value>
Description The DB2 database name. Valid Values Valid database name. Ex. proddb This parameter is not optional. It can be specified as environment variable. Command line option --db2database <value> or -D <value>
Description Mode of application when snapshot operation is to be performed. Valid Values Offline or online. Default value is online. Command line option --app_mode <value> or --online | --offline
Description Name of clonedb DB2 database that is be created during clone operation. Valid Values Character string. Ex. clone1 If not specified, clone name is auto-generated. Command line option --clone_name=<value>
Description Filesystem path on which the clone application instance is to be mounted. Valid Values Valid path. Ex. /tmp/cln If not specified, clone path is auto-generated. Command line option --clone_path <value> or --mount_path <value> or --on <value> or --at <value>
Description Prefix for snapshot volumes. Valid Values Character string. Ex. SNP_ Default prefix is SNAP_. Command line option --snapshot_vol_prefix <value> or --prefix <value>
Description Prefix for snapshot diskgroup(s). Valid Values Character string. Ex. SNP_ Default prefix is SNAP_. Command line option --snapshot_dg_prefix <value> or --prefix <value>
Description User needs to tag the mirror which is to be split during snapshot operation. If no mirror is tagged, snapshot operation would error out. Valid Values Character string. Ex. snapshot_plex Default value is dbed_flashsnap. Command line option --snapshot_plex_tag <value> or --plex <value>
Description Number of set of mirrors that have snapshot plex tag set. Valid Values Number. Ex. 2 Default value is 1. Command line option --snapshot_mirror <value> or --n <value>
Description Specified if the archive logs should be snapshotted or not. Valid Values Yes, no or auto Default is auto. Auto means that archive logs will be snapshot depending on whether log archiving is enabled or not. If log archiving is not enabled, archived logs will not be snapshot. If log archiving is enabled, and if at least one of the archive log destinations (specified by the logarchmeth1 and logarchmeth2 parameters) is set to a local DISK: destination, then archived logs will be snapshot.
Command line option --snapshot_archive_log y|n|auto or --snapshot_archive_log or --no_snapshot_archive_log
Description Volume-to-mountpoint mapping provided by the user. Valid Values <dg>:<vol>=<path>;<dg2> <vol2>=<path2> Ex:testdg1:datavol=/tmp/so;
Command line option --mapped_mounts=<dg>:<vol>=<path>; <dg>:<vol>=<path> or --map <dg>:<vol>=path or --map <dg>:vol=path
1. Create a default configuration file$ vxsfadm -s flashsnap -a db2 -o setdefaults --db2instance inst1 --db2database proddb --flashsnap_name daily_snap -c dailyconfig
This will create a default configuration file with all the parameters and default values. If required, user can modify the parameters otherwise the file can be used as is.
Note: If DB2INSTANCE and DB2DATABASE parameters are exported in environment, there is no need to mention it on command line. In the following examples, we assume that DB2INSTANCE and DB2DATABASE parameters are available from the environment.
2. Validate database and system setup for flashsnap using default options
$ vxsfadm -s flashsnap -a db2 -o validate --flashsnap_name daily_snap
Use a configuration file for customizing snapshot configuration
$ vxsfadm -s flashsnap -a db2 -o validate -c dailyconfig
3. Create a snaphot
$ vxsfadm -s flashsnap -a db2 -o snap --flashsnap_name daily_snap
This step would break the required mirror from the primary volume(s). Create a new disk group with name as specified by the parameter snap_dg_prefix (by default SNAP_).
Note: All the parameters are read and stored at validation stage in repository, including mandatory parameters --db2instance,--db2database and --flashsnap_name. In case user needs to change anything please change the configuration file and use -c option along with the above command.
$ vxsfadm -s flashsnap -a db2 -o snap -c dailyconfig
4. Mount snapshot
$ vxsfadm -s flashsnap -a db2 -o mount --flashsnap_name daily_snap
This command would mount the snapshot on the host running database instance. By default, snapshot volumes would be mounted in /var/tmp filesystem.
If user needs to specify alternate mount location, either provide CLONE_PATH on command line or from the config file as:
$ vxsfadm -s flashsnap -a db2 -o mount --flashsnap_name daily_snap --clone_path /clonedb2
Make sure /clonedb2 directory exists and has appropriate permissions for db2 user.
If the configuration file exists, user can use
$ vxsfadm -s flashsnap -a db2 -o mount -c dailyconfig
5. Clone database on snapshot
$ vxsfadm -s flashsnap -a db2 -o clone --name daily_snap --clone_name newclone
If user has already specified the clone_name and clone_path in configuration file which was used during VALIDATE state, --clone_name is not required on command line.
$ vxsfadm -s flashsnap -a db2 -o clone --name daily_snap --clone_name newclone
If the configuration file is present
$ vxsfadm -s flashsnap -a db2 -o clone -c dailyconfig
6. Resynchronize snapshot mirrors back to primary volumes
$ vxsfadm -s flashsnap -a db2 -o resync --name daily_snap
This step would resynchronize all the mirrors which were broken during snapshot state back to primary volumes. After the resync operation is complete and mirrors are in SNAPDONE state (check vxprint output for the volumes). User can take fresh snapshot after resync operation.
vxsfadm provides a facility to user to directly perform end operation, without a need to perform intermediate states.Clone a database on secondary host
$ vxsfadm -s flashsnap -a db2 -o clone --db2instance inst1 --db2database mydb --flashsnap_name dailysnap --secondary_host host2 --clone_name dailyclone
Above command would create a clone database on host2. The database name of clone database would be dailyclone and would be mounted in /var/tmp directory. The DB2INSTANCE and uid of db2insatnce user should be same on both the nodes. All the other parameters are assumed and assinged a default values as mentioned in parameter table.
If DBA needs to mount the clone database on secondary to some other location with different sid, user need to execute following command
$ vxsfadm - s flashsnap -a db2 -o clone --db2instance inst1 --db2database mydb --flashsnap_name dailysnap --secondary_host host2 --clone_path /home/newclonepath --clone_sid newsid
If user has a config file generated using setdefaults operation, change the appropriate parameters and execute the command as below
$ vxsfadm -s flashsnap -a db2 -o clone -c dailyconfig
vxsfadm (1M), vxsfadm-db2(1M), vxsfadm-flashsnap (1M)vxsfadm-checkpoint (1M), vxsfadm-db2-checkpoint (1M)
Storage Foundation | vxsfadm-db2-flashsnap(1M) |