Library Table of Contents Index Previous Page (Alt-p) Next Page (Alt-n) Comments

Using Run Command After Operation to archive automatically

SnapManager includes the ability to automatically run your own program or script after a backup or database verification operation finishes successfully. This feature, called Run Command After Operation, is typically used to automatically archive a backup. See the following topics for more information:

How you can launch your own program or script  Top

When you start or schedule a SnapManager backup or database verification operation, you can specify that SnapManager automatically run a command after the operation finishes successfully. If you choose this option, you will be prompted to specify the following information:

  1. The host system from which the command is to be run
  2. The full path of the command that you want SnapManager to run after the backup or database verification finishes successfully
  3. Any parameters that are to be passed to the command

    Because the command is invoked from within the context of a specific backup or database verification, you can pass the command information about the components of that operation.

    In your script, any occurrence of the text string %1 corresponds to the first parameter passed; the text string %2 corresponds to the second parameter, and so on.

Command arguments pass information to your program or script  Top

The Run Command After Operation feature supports the following variables, which can pass operation-specific information to your program or script.

Variable

Description

$ExchSnapshot

Expands to the name of an Exchange database Snapshot copy. Examples:

exchsnap__winsrvr3__01-31-2006_15.03.09 
exchsnap__winsrvr3__recent 

Note
The number of database Snapshot copies in a SnapManager backup set depends on the number of volumes used to store the storage groups included in the backup.

$InfoSnapshot

Expands to the name of a SnapInfo directory Snapshot copy. Examples:

eloginfo__winsrvr2__01-31-2006_15.03.09
eloginfo__winsrvr2__recent 

$SnapInfoName

Expands to the name of the SnapInfo directory. Examples:

WINSRVR3__01-23-2006_16.21.07__Daily
WINSRVR3__recent 

Note
If you use this variable, you must also provide the correct path to the directory.

$SnapInfoPath

Expands to the name of the SnapInfo subdirectory. Example:

I:\SME_SnapInfo\EXCH__WINSRVR3\SG__First 
Storage Group\WINSRVR5_01-06-2006_11.52.36 

The $SnapInfoPath variable is automatically enclosed within double quotes 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 quotes to appear in your command line, remove them from the Command Arguments field in the Run Command After Operation dialog box.

Specifying the command to be run after the operation succeeds  Top

While specifying a SnapManager backup or verification operation, you can use the Run Command After Operation dialog box to specify the details of the command you want to run after the backup or verification operation finishes.

Note
You can specify default values for the command arguments so that you do not have to enter the command information each time you initiate a backup or verification. For details, see Managing the Run Command After Operation default settings.

Procedure

To run a command or invoke a batch file after backup or verification, complete the following steps.

Step

Action

1

Open the Run Command After Operation dialog box.

From the...

Do this...

Backup and Verification tab

  1. Specify a database backup or a verification of the databases and transaction logs in the most recent backups.
  2. Select the Run Command After Operation option.
  3. Click Backup Now or Verify Now.

Backup Wizard

  1. Step through the wizard screens to specify a full database backup, a transaction log only backup, or a database verification.
  2. In the Run a Command After the Operation screen, select the option labeled "Yes, run a command after this operation", and then click Next.

Result

The Run Command After Operation dialog box appears and displays the current default settings.

2

In the "Specify a computer where..." box, enter or browse to the name of the host on which your program or script resides.

3

In the "Specify the full path..." box, browse to your program or script.

Note
If the script is stored on a network share, use the UNC path rather than the network drive letter to specify the script's location. If SnapManager is installed on a Windows Server 2003 system, then add the network location to Internet Explorer's list of trusted sites, otherwise the command could fail silently

4

Form the command input string in the Command Arguments box. You can do this using any combination of the following methods:

  • To enter text directly into the Command Arguments box, click in the box and type the desired text.
  • To enter a SnapManager variable into the Command Arguments box, do the following:
    1. If necessary, click in the Command Arguments box to position the cursor.
    2. In the SnapManager Variables list, select the variable you want to enter.

      For more information, see Command arguments pass information to your program or script.

    3. Click Select.

Notes

  • The $SnapInfoPath variable is automatically enclosed within double quotes 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 quotes to appear in your command line, remove them from the Command Arguments field in the Run Command After Operation dialog box.
  • If more than one Snapshot copy exists for this operation, you must include that Snapshot copy type's variable name once for every Snapshot copy. If you do not, you cannot create a complete archive.

For details, see Command arguments pass information to your program or script.

5

Repeat Step 4 as needed until the Command Arguments box contains the arguments you want to pass to your program or script.

6

Click OK to apply your changes, close the Run Command After Operation dialog box, and return to the backup or verification setup process.

Result:

After when the backup or verification finishes successfully, the command you specified, with the Snapshot copy and SnapInfo information for this backup operation inserted, runs automatically.

Example

Suppose you want to run the script C:\SnapManager Scripts\scriptname.txt with the following parameters:

The corresponding Run Command After Operation dialog box would look like this:

For more examples, see Using NDMP or dump to archive SnapManager backups and Using a Windows backup utility to archive SnapManager backups.

Running a script from a UNC path on a Windows Server 2003 system  Top

If SnapManager is installed on a Windows Server 2003 system, then attempting to launch a script from a UNC (Uniform Naming Convention) path might cause SnapManager to hang. If this occurs, the log file shows no indication of the failure other than it is missing the last line of text: "The specified command has been launched successfully."

Windows Server 2003 ships with Internet Explorer's Enhanced Internet Explorer Security Configuration enabled. This setting is restrictive and prevents batch files located on a network share from running. The network location will need to be added to Internet Explorer's list of trusted sites.

To run a script from a UNC path on a Windows Server 2003 system, complete the following steps.

Step

Action

1

Log in to the Windows Server 2003 system that will be running the script.

2

Launch Internet Explorer.

3

In the menu bar, select Tools > Internet Options.

Result

The Internet Options dialog box appears.

4

In the Internet Options dialog box, do the following:

    1. Select the Security tab.
    2. In the Security tab, select the Local intranet icon, and then click Sites.

Result

The Local Intranet dialog box appears.

5

In the Local Intranet dialog box, do the following:

    1. In the "Add this Web site to the zone" box, enter the host name of the machine from where the script will be launched.
    2. Click Add.

Result

The host name is added to the Web Sites list.

6

Click Close to close the Local Intranet dialog box.

7

Click OK to close the Internet Options dialog box.

8

To verify your changes, browse to the network location where the script resides and launch the script.

Result

The script should now run normally without security prompts.

Note
Although the script should run, it might actually fail to complete properly because the SnapManager variables are not be passed to the script in this test.

Note
These security settings are specific to each user account on each machine. You will need to repeat this procedure for on all machines that might be used to run scripts and for all users that might launch the script on each machine. You will also need to repeat these steps if you start using a different user account to run SnapManager.

Library Table of Contents Index Previous Page (Alt-p) Next Page (Alt-n) Comments