You are on page 1of 7

Appendix A.

Using the Storage Manager scheduler


This section provides an example of how to use the Storage Manager scheduler with Data Protection for SQL to automate online backups of SQL Server databases. This example illustrates the use of the Storage Manager central scheduler client and creating a full backup of your SQL databases. Note: To ensure that this example works, you should obtain and install the latest Storage ManagerBackup-Archive Client. The latest Storage Manager client PTFs (service packs) are available at the following URL: http://www.tivoli.com/support/storage_mgt/ Once Data Protection for SQL has been registered to a Storage Manager Server and installed on the SQL Server, the procedure consists of the following steps: 1. On the Storage Manager Server: a. Define a schedule to execute a Windows command file. This schedule must be defined in the policy domain to which Data Protection for SQL is registered. b. Associate the Data Protection for SQL node to the defined schedule. 2. On the machine where SQL Server and Data Protection for SQL are installed: a. Install the Storage Manager scheduler client as a Windows service for Data Protection for SQL. If a scheduler already exists for the regular Storage Manager backup client, install another one for Data Protection for SQL. b. Define a command file that contains the Data Protection for SQL commands to do the desired backup. Note: Refer to Windows documentation for details on creating a Windows command file. c. If you are running in a cluster server environment, install the Storage Manager scheduler client as a Windows service on the secondary node of the cluster. d. If you are running in a cluster server environment, create a new cluster resource that represents the Storage Manager scheduler client. e. Start the scheduler installed in step 2a (this is step 2.1 in some HTML browsers).

Scheduler example
The following example uses these assumptions: Data Protection for SQL is registered to a Storage Manager Server with a node name of mars and a password of marspswd in policy domain sqagents. The event to be scheduled is a daily full backup of all of the SQL databases. The backups are to begin between 9:00 and 9:15 pm. This method is flexible because you can define a command file with any set of commands you choose. This allows you to use the same Storage Manager schedule for other Data Protection for Microsoft SQL Server applications on Windows as well. On the Storage Manager Server:

1. Enter the following command to define the schedule. You can enter this command on the server console or from an administrative client. The administrative client does not have to be running on the same system as the Storage Manager Server. 2. def sched sqagents sql_daily_full desc="SQL Daily Full Backup" 3. action=command objects="c:\sqlfull.cmd" priority=2 starttime=21:00 4. duration=15 duru=minutes period=1 perunits=day dayofweek=any Storage Manager displays this message: ANR2500I Schedule SQL_DAILY_FULL defined in policy domain SQAGENTS. 5. To associate Data Protection for SQL to this schedule, issue the following command: 6. define association sqagents sql_daily_full mars Storage Manager displays this message: ANR2510I Node MARS associated with schedule SQL_DAILY_FULL in policy domain SQAGENTS. At this point, a schedule has been defined on the Storage Manager Server that runs a command file called c:\sqlfull.cmd. The schedule starts at 9:00 pm. The schedule is reexecuted once a day and can start on any day of the week. Use the QUERY SCHEDULE and QUERY ASSOCIATION Storage Manager administrative commands to confirm the schedule and association have been set correctly. In Steps 1 and 2 above, if you are setting up the scheduler for a SQL Server running in a cluster environment, your command file should reside on the SQL Server File Share. The schedule you define on the Storage Manager Server needs to match this command file. So, instead of c:\sqlfull.cmd, the command file could be x:\sqlfull.cmd, where x is the SQL Server File Share. On the SQL Server: This example assumes that you installed the Storage Manager client in the directory d:\Program Files\Tivoli\TSM\baclient, and Data Protection for SQL in the directory d:\Program Files\Tivoli\TSM\TDPSql. It is also assumed that the options files in each of these directories has been updated so that the communication parameters point to the Storage Manager Server. 1. Login using a Windows account that has administrative privileges. 2. Open a Windows command prompt window. 3. In the window, issue the following command: 4. cd /d d:\Program Files\Tivoli\TSM\baclient Tips: If a Storage Manager scheduler is already installed on your machine (for the regular backups of the Windows system), you need to install another one (with a unique name) to run the schedules defined for Data Protection for SQL. The Storage Manager scheduler should have a different node name from the regular Storage Manager backup client. If the path you want to use has a space in it, you can place quotation marks around the section of the pathname that contains a space (d:\"Program Files"\Tivoli\ TSM\baclient).

You can also use the short form of a pathname by placing a tilde (~) and unique identifier after the first six characters in the path. An example of the short form of the path is as follows: d:\Progra~1\Tivoli\TSM\baclient 5. In the window, issue the following command: 6. dsmcutil inst /name:"TSM TDPSQL Scheduler" 7. /node:mars /password:marspswd /autostart:yes 8. /clientdir:"d:\Program Files\Tivoli\TSM\baclient" 9. /optfile:"d:\Program Files\Tivoli\TSM\tdpsql\dsm.opt" 10. /startnow:no Note: If you are setting up the scheduler for a SQL Server running in a cluster environment, you need to change the /autostart option to no. For example: /autostart:no

An example of the output is shown below: Storage Manager Windows Client Service Configuration Utility Command Line Interface Version 3.00.a Last Updated May 2, 2000 Storage ManagerApi Version 4.1.2 Command: Install Storage Manager Client Service Machine: MARS (Local Machine) Installing Storage Manager Client Service: Machine : MARS Service Name : Storage Manager TDPSQL Scheduler Client Directory : d:\Program Files\Tivoli\TSM\baclient Automatic Start : No Logon Account : LocalSystem The service was successfully installed. Creating Registry Keys ... Updated Updated Updated Updated Updated Updated Updated registry registry registry registry registry registry registry value value value value value value value 'ImagePath' . 'EventMessageFile' . 'TypesSupported' . 'OptionsFile' . 'EventLogging' . 'ClientNodeName' . 'ADSMClientKey' .

Generating registry password ... Authenticating password with Storage Manager for node MARS .... Connecting to Storage Manager Server via client options file 'd:\Program Files\Tivoli\TSM\TDPSql\dsm.opt' ...

Password authentication successful. The Registry password for node MARS has been updated . Note that the options file that is defined for Data Protection for SQL is used by the scheduler when validating the node and password. The options files are also used when contacting the Storage Manager Server for schedule information. This example assumes that the dsm.opt file is updated so that the communication parameters point to the Storage Manager Server to which the SQL databases are to be backed up. If you see the following message: A communications error occurred connecting to the Storage Manager Server Ensure that the dsm.opt file contains entries that point to the correct Storage Manager Server. Also ensure that the Storage Manager Server is running. If you have to correct one of these, issue the following command: dsmcutil remove /name:"Storage ManagerTDPSQL Scheduler"

Then reissue the command given in step 4. Note: If you are setting up the scheduler for a SQL Server running in a cluster environment, repeat steps 1 through 4 on the secondary node of the cluster. Each scheduler you install must have a unique name. 11. Create a command file called c:\sqlfull.cmd. Note: If you are setting this scheduler up for a SQL Server running in a cluster environment, the command file should reside on the SQL Server File Share. Instead of c:\sqlfull.cmd, this command file could be x:\sqlfull.cmd, where x is the SQL Server File Share. A sample command file, sqlfull.smp, is provided with Data Protection for SQL in the directory where Data Protection for SQL is installed. This sample command file contains a command to do a scheduled full backup to Storage Manager of all the SQL databases. Tip: The key to using the Storage Manager scheduler to execute the commands in a command file is that complete paths must be given for all file names and non-system commands. This is because the Central scheduler runs from the Windows system directory. The Windows system directory is where the scheduler looks for input and produces its output by default. 12. At this point the scheduler is installed, but has not been started. To start the service in a nonclustered environment, issue the following command in the Windows console window: 13. net start "Storage Manager TDPSQL Scheduler" The following output is displayed: The Storage Manager TDPSQL scheduler is starting.

The Storage Manager TDPSQL scheduler was started successfully. Note that because the /autostart:yes option is used, the Storage Manager scheduling service is automatically started each time the Windows system is rebooted. Note: Steps 7 through 14 apply only when running Data Protection for SQL in a clustered environment. The newly created scheduler will be tied to a cluster group. This allows the scheduler to correctly fail over between the nodes and also manage automatic password changes. 14. Start the Cluster Administrator. 15. Select the SQL Server Cluster Group and create a new Resource to represent the Data Protection for SQL scheduler (File->New->Resource). For example: 16. Name: Storage Manager TDPSQL Scheduler 17. Description: Storage Manager TDPSQL Scheduler 18. Resource Type: Generic Service 19. Group: MARSSQL1 20. 21. Dependencies: MARSSQL1 SQL Server 7.0 22. 23. Service Name: Storage Manager TDPSQL Scheduler 24. (this MUST match the name of the service 25. that you installed earlier) 26. 27. Registry Replication: None 28. IMPORTANT! Do not set up Registry Replication at this time. This action is performed in a later step. 29. In the Windows command prompt window, change to the Data Protection for SQL installation directory. 30. cd /d d:\Program Files\Tivoli\TSM\TDPSql 31. 32. Enter a command that connects with the Storage Manager Server. Specify the /tsmpassword=tsmpasswordname parameter to ensure the correct password is stored in the registry. This allows the scheduler to properly connect automatically to the Storage Manager Server. 33. tdpsqlc back model full /tsmp=marspswd /sqlserver=marssql1 34. Note: In the clustered environment, there must be a CLUSTERNODE YES statement in the current Storage Manageroptions file. 35. From the Cluster Administrator, select the new resource and bring it online ( File-> Bring Online). 36. Select the new resource and modify its properties (File-> Properties). Under the Registry Replication tab, add a new entry for the Data Protection for SQL nodename password registry entry. For example: 37. SOFTWARE\IBM\TSM\CurrentVersion\BackupClient\NODES\<nodename> 38.

Replace <nodename> with your Data Protection for SQL node name. For example: SOFTWARE\IBM\TSM\CurrentVersion\BackupClient\NODES\MARS

39. From the Cluster Administrator, select the new resource and take it offline ( File->Take Offline). This stores the encrypted password in the quorum device so that a failover will pick up the correct registry entries. 40. From the Cluster Administrator, select the new resource and bring it online again ( File->Bring Online). Your system is now ready to run automatic daily full backups of the SQL databases. Notes: 1. If you use the Storage Manager Server-prompted scheduling mode, then you must ensure that the Data Protection for SQL option file has the TCPCLIENTADDRESS and TCPCLIENTPORT options specified. Server-prompted scheduling is supported only when TCP/IP communication is being used. By default, Data Protection for SQL uses the client polling scheduling mode. If more than one scheduler will be running on this machine, use the same TCPCLIENTADDRESS. However, you must use a different value for TCPCLIENTPORT and NODENAME for each scheduler. An example of running more than one scheduler is when you are scheduling Data Protection for SQL as well as the regular Windows backup client. 2. If any changes that affect the scheduler are made to the Data Protection for SQL options file, the scheduler has to be restarted in order to pick up the changes. An example of this is the Storage Manager Server address, the schedule mode, or the client TCP address or port. This can be done by issuing the following commands: 3. net stop "Storage Manager TDPSQL Scheduler" 4. net start "Storage Manager TDPSQL Scheduler" Note: IMPORTANT! If you are running the scheduler in a clustered environment, use the Cluster Administrator to stop and restart your scheduler. 5. The file named dsmsched.log contains status information for the Storage Manager central scheduler. In this example, the file is located in this path: d:\Program Files\Tivoli\TSM\baclient\dsmsched.log You can override this file name by specifying the SCHEDLOGNAME option in the Data Protection for SQL options file. 6. By default, Data Protection for SQL creates its own log file with statistics about the backed up database objects. In the previous example (see sqlfull.smp), the log file is sqlfull.log. This file is different from the Storage Manager scheduler log file and must also be different from the file to which the tdpsqlc command output is redirected. In this same example, this file is dsmsched.log. Note: Output from scheduled commands are sent to the scheduler log file ( sqlsched.log). After scheduled work is performed, check the log to ensure the work completed successfully.

When a scheduled command is processed, the scheduler log can contain the following entry: Scheduled event eventname completed successfully This is merely an indication that Storage Manager successfully issued the scheduled command associated with the eventname. No attempt is made to determine the success or failure of the command. You should assess the success or failure of the command by evaluating the return code from the scheduled command in the scheduler log. The scheduler log entry for the command's return code is prefaced with the following text: Finished command. Return code is: 7. If Data Protection for SQL is not configured to automatically generate the Storage Manager password when it expires, then the new Storage Manager password needs to be specified on the tdpsqlc command. To specify the password, use the /tsmpassword parameter in the command file being run by the scheduler (sqlfull.cmd) or specify it on the Data Protection for SQL command line; for example: 8. tdpsqlc query tsm /tsmnode=mars1 /tsmpassword=newpassword

You might also like