You can use several arguments for commands that you want to run before or after a SnapManager operation.
Precommand arguments
The following precommand arguments apply to backup, verify, restore, and clone operations:
Variable Description
$Database Specifies the logical name of the database processes.
To prevent PowerShell from interpreting the value of this parameter, be sure to enclose the entire parameter value with single quotes: -PreCmdArg '$Database $ServerInstance'.
Example:
DatabaseAccounting
If you want to have more than one database expanded, repeat the parameter as many times as you want.
Example:
AccountingDB1 AcmeServer1/SqlInst1 FinanceDB2 AcmeServer1/SqlInst2
Variable Description
$ServerInstance Specifies the name of the SQL server instance that is actually processed.
Example:
ACMESERVER1\SQLINSTANCE1
Postcommand arguments
The following postcommand arguments apply to backup, verify, restore, and clone operations.
Note: To prevent PowerShell from interpreting the value of a parameter, be sure to enclose the entire parameter value within single quotes: -PostCmdArg ‘$Database $ServerInstance
$SqlSnapshot'
Variable Description
$InfoSnapshot Expands to the name of a SnapInfo directory Snapshot copy.
Examples:
sqlinfo__winsrvr2__01-31-2014_15.03.09
sqlinfo__winsrvr2__recent
$LogBackupFile Expands to the full path name of the transaction log backup file.
Example:
I:\SMSQL_SnapInfo\SQL__WINSRVR2\DB__Northwind
\LogBackup\ 11-01-2004_13.34.59__Northwind.TRB
$OperationStatus Provides the status of the SMSQL operation.
Example:
5234
$PreCommandStatus Provides the precommand status to the postcommand if the postcommand is executed based on the status of the earlier precommand.
Example:
5234
$SnapInfoName Expands to the name of the SnapInfo directory.
Examples:
WINSRVR2__recent
WINSRVR2_11-23-2013_16.21.07__Daily
If you use this variable, you must also provide the correct path to the directory.
Variable Description
$SnapInfoPath Expands to the name of the SnapInfo subdirectory. This argument is used in backup and verification operations.
Example:
I:\SMSQL_SnapInfo\SQL__WINSRVR2\DB__Northwind For restore and clone operations, this argument specifies the path to the Snapshot copy information metadata that is being used for the database restore.
Example:
U:\SMSQL_SnapInfo\VDISK__E\FG__
\05-14-2010_15.33.41\SnapInfo__05-14-2010_15.33 .41.sml
$SqlSnapshot Expands to the name of an SQL Server database Snapshot copy.
This argument is used for backup and verification operations.
Examples:
sqlsnap__winsrvr2__01-31-2014_15.03.09
sqlsnap__winsrvr2__recent
The number of database Snapshot copies in a SnapManager backup set depends on the number of volumes used to store the databases included in the backup.
For restore and clone operations, this argument specifies the name of the Snapshot copy to be restored.
Example:
sqlsnap__winsrvr2__01-31-2014_15.03.09 sqlsnap__winsrvr2__recent
Several parameters, like the $SnapInfoPath and $LogBackupFile variables, are enclosed within double quotes by default so that the actual path name can contain spaces without affecting the script invocation on the Windows command line. If you do not want the double quotation marks to appear in your command line, remove them from the Command Arguments field in the Run Commands dialog box.
The following postcommand arguments apply only to restore and clone operations:
Variable Description
$StandbyFile This is the full file system path of the SQL standby file used on a restore. This file path is calculated during the restore-clone operation as a temporary file when incomplete transactions are removed from the database and stored in the file for later use.
The user requests to generate a standby (or undo) file in a certain directory, but the full file name path actually used is not known until the restore or clone operation is launched. This happens when several databases are restored at the same time to the same LUNs. By default, this is created in the snap-info directory.
Example:
U:\SMSQL_SnapInfo\VDISK__E
\UNDO_SECLOCSYS_db5.dat
$TargetDatabase Specifies the destination name of the database to restore.
Example:
DatabaseAccountingRestoredCopy
$TargetServerInstance Specifies the destination SQL Server instance to be used.
Example:
ACMESERVER2\SQLINSTANCECOPY
$TargetDatabaseFile Specifies the target file system database path to be used.
Example:
Z:\MNT\NETAPP1\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data
\DatabaseAccounting.mdf
Command arguments that are operation-specific
Each SnapManager operation that supports the Run Commands feature parses only the variables that apply to the operation as you have specified it.
The following table shows which of the command variables are available to the Run Commands feature, depending on which SnapManager operation is used to invoke the feature, and in what context those variables are parsed:
Variable SnapManager operation used to invoke the Run Commands feature Full backup Transaction
log backup
Verification of full backup
Restore Clone
$Database Parsed Parsed Parsed Parsed Parsed
$InfoSnapshot Parsed Parsed Not parsed Not parsed Not parsed
$LogBackupFile Parsed Parsed Not parsed Not parsed Not parsed
Variable SnapManager operation used to invoke the Run Commands feature Full backup Transaction
log backup
Verification of full backup
Restore Clone
$ServerInstance Parsed Parsed Parsed Parsed Parsed
$OperationStatus Parsed Parsed Parsed Parsed Parsed
$PreCommandStatus Parsed Parsed Parsed Parsed Parsed
$SnapInfoName Parsed Parsed Parsed Not parsed Not
parsed
$SnapInfoPath Parsed Parsed Parsed Not parsed Not
parsed
$SqlSnapshot Parsed Not parsed Parsed Parsed Parsed
$StandbyFile Not parsed Not parsed Not parsed Parsed Parsed
$TargetDatabase Not parsed Not parsed Not parsed Parsed Parsed
$TargetDatabaseFi le
Not parsed Not parsed Not parsed Parsed Parsed
$TargetServerInst ance
Not parsed Not parsed Not parsed Parsed Parsed