A sample C shell maintenance script

Next, the script invokes an isql backup script for each database for which no 2500-level errors occurred and adds the “Backing up database_name” line to dbcc_mail.out. For example, the script master.backup backs up the master database:

use master go

dump database master to master_dump go

You may want to add appropriate dump transaction commands to your scripts.

If there are 2500-level error messages, the script does not back up the database. At the end of the script, dbcc_mail.out is mailed to the System Administrator “jjones,” who then has a record of fatal dbcc errors and successful backups.

You can tailor the sample shell and isql scripts to suit the needs of your installation.

To have the scripts execute automatically, edit the crontab file, and add an entry similar to this:

00 02 * * * /usr/u/sybase/dbcc_ck 2>&1

This example executes a C shell script called dbcc_ck every morning at 2:00 a.m.

46

Adaptive Server Enterprise

Page 62
Image 62
Sybase DC35823-01-1500-04 manual Sample C shell maintenance script