Sybase DC35823-01-1500-04 Server User Manual


 
CHAPTER 3 Configuring the Operating System
Configuration Guide 45
•The
ps command gives you an accurate snapshot of accumulated CPU
time and usage for individual processes. This can be very helpful in
determining the dataserver-, engine-, and process-specific loading.
•The
time command can be useful in determining the various user, system,
and real-time resources used over a complete run.
For details about these tools, see your operating system documentation.
A sample C shell maintenance script
Running dbcc checks and performing database backups protect the integrity
and recoverability of your Adaptive Server databases. The following sample C
shell script calls several
isql scripts to help you do this:
#!/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 and dbcc checkdb for each database and sends the
messages to an output file called dbcc_out.
For example, the script
master.dbcc runs dbcc to check the master database:
dbcc checkalloc (master)
go
dbcc checkdb (master)
go
The C shell script then runs the grep command to find 2500-level error
messages in the
dbcc output. The results of the grep command go into an output
file called dbcc_mail.out.