Basic Functions of the VSS Snapshot Scheduler Wizard:
1. Adds a snapshot schedule
2. Automates the process of refreshing snapshot sets
3. Snapshot volumes are automatically reattached, resynchronized, and then split again by the Snapshot scheduler
4. Allows for commands to be executed before and after the wizard is executed by way of the pre command and post command options.
5. The VSS Snapshot Scheduler wizard does not prepare the snapshot mirror.
As explained in item 4 above, the VSS scheduler wizard gives 2 options to complete pre commands and post commands. If these option are not enough and there is a need automate a script in place of the wizard (eg. requested by a customer’s environment which calls for scripting). The following manual commands will need to included in the script to perform the snap off and reattach procedure.
The syntax below shows an example for creating a snapshot.
vxsnap [-x <filename>] create [diskgroupname] [source=<(volumename or driverletterandpath>] [/DriveLetter=<driveLetter>][/DrivePath=<drivePath>] [/Newvol=<newVolName>][/Plex=<plexName>]... writer=<writerName> component=<componentName or databasename>[server=<servername>] [Instance=<instancename>] [backuptype=<backuptype>] [-O] [-C] [secHosts=<secondary hosts>]
1. Using SQLserverwrtier, the example below shows how to create two snapshots for the data and log volumes.
vxsnap -x g:\SnapshotSet.xml create -ginst1-dg source=E:\ DriveLetter=H:\ /Newvol=copy-ins1-data /Plex=ins1-data-02 source=G:\ DriveLetter=I:\ /Newvol=copy-inst1-logs /Plex=inst1-logs-02 writer=sqlserverwriter component=usr-851 server=VS-851 instance=inst1 backuptype=full -o
2. Using SQLserverwriter, the example below show s how to reattach the snapshot previously created.
C:\Users\admin> vxsnap -x g:\SnapshotSet.xml reattach writer=sqlserverwriter
Importing things to note:
As with any command sting, the syntax here is the same. The command is very specific and does not allow mistakes. It will not run if there is one character out of place. It also will not run with a typographical error. It is important to gather all the necessary information correctly to ensure a successful script.
Explaining Items in the VSS snap procedure:
1. Vxsnap -x - Initial snap command
2. [<filename>] - XML file to store the database and snapshot volume metadata
3. create [diskgroupname] - Disk group that contains volumes to be snapped
4. [source=<(volumename or driverletterandpath>] – Drive letter of volume that contains disks that will be snapped
5. [/DriveLetter=<driveLetter>] Driver letter that snapped off to
6. [/DrivePath=<drivePath>] – A path can be specified if your situation calls for it, this was not used in the example above.
7. [/Newvol=<newVolName>] – Name of the snap volume that will be created
8. [/Plex=<plexName>] - The Plex name of volume that will be snapped
9. writer=<writerName> Each application has its own writer. In the case above the writer is SQLSERVERWRITER
10. component=<componentName or databasename> The database that is being snapped. In the case above this was usr-851
11. [server=<servername>] The virtual servername of the SQL instance
12. [Instance=<instancename>] The instance name
13. [backuptype=<backuptype>] backup can be a Full backup or a copy backup
16. [secHosts=<secondary hosts>]
Explaining items in the reattach procedure:
1. vxsnap -x - Initial snap command
2. g:\SnapshotSet.xml - Location of XML file that contains the database and snapshot volume metadata information
3. reattach - Command to reattach the snapped volume
4. writer=sqlserverwriter - Each application has its own writer. In the case above the writer is SQLSERVERWRITER