A Sample C Shell Maintenance Script - Sybase Adaptive Server Configuration Manual

Table of Contents

Advertisement

A sample C shell maintenance script

Configuration Guide
The
command gives you an accurate snapshot of accumulated CPU
ps
time and usage for individual processes. This can be very helpful in
determining the dataserver-, engine-, and process-specific loading.
The
command can be useful in determining the various user, system,
time
and real-time resources used over a complete run.
For details about these tools, see your operating system documentation.
Running
checks and performing database backups protect the integrity
dbcc
and recoverability of your Adaptive Server databases. The following sample C
shell script calls several
#!/bin/csh -f
if ( -e dbcc_mail.out) then
rm dbcc_mail.out
endif
foreach i (*.dbcc)
isql -Usa -Ppassword < $i > dbcc_out
if ( 'grep -c 'Msg 25[0-9][0-9]' dbcc_out' ) then
echo "There are errors in" $i >> dbcc_mail.out
cat dbcc_out >> dbcc_mail.out
else
echo "Backing up " $i:r >> dbcc_mail.out
isql -Usa -Ppassword < $i:r.backup
endif
end
mail -s "Backup Report" jjones < dbcc_mail.out
The first set of scripts (one for each database with a file name appended with
.dbcc) runs
dbcc checkalloc
messages to an output file called dbcc_out.
For example, the script
dbcc checkalloc (master)
go
dbcc checkdb (master)
go
The C shell script then runs the
messages in the
output. The results of the
dbcc
file called dbcc_mail.out.
CHAPTER 3
Configuring the Operating System
scripts to help you do this:
isql
and
dbcc checkdb
runs
master.dbcc
dbcc
command to find 2500-level error
grep
for each database and sends the
to check the
database:
master
command go into an output
grep
45

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Adaptive Server and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Adaptive server enterprise 15.0

Table of Contents