| |
 |
|
Scheduling and Customizing Oracle
Alert Reports
Oracle Tips by Burleson Consulting
|
In a UNIX environment, the Oracle Remote DBA can
easily control the times when the STATSPACK alert reports are
executed. Let’s begin by examining a UNIX crontab file that schedules
these reports.
A Sample UNIX Crontab to Schedule Oracle Reports and Alerts
The sample UNIX crontab file that follows is used to
schedule STATSPACK reports and alert scripts:
#****************************************************************
# This is the weekly table and index analyze job for the CBO
#****************************************************************
30 7 1 * * /home/analyze.ksh > /home/analyze.lst
#****************************************************************
# This is the weekly (Monday) object analyze and report for
management
#****************************************************************
30 7 * * 1 /home/oracle/obj_stat/get_object_stats.ksh prodb1
00 8 * * 1 /home/obj_stat/run_object_report.ksh prodb1
#****************************************************************
# This is the daily STATSPACK exception report for the Remote DBAs
#****************************************************************
30 7 * * * /home/statspack/statspack_alert.ksh prodsid
#****************************************************************
# This is the daily generic alert report for the Remote DBAs
#****************************************************************
00 7 * * * /home/mon/oracheck.run prodsid > /home/mon/o.lst
#****************************************************************
# This is the daily vmstat collector & report for the Remote DBAs and SAs
#****************************************************************
00 7 * * * /home/vmstat/run_vmstat.ksh > /home/vmstat/r.lst
05 7 * * * /home/vmstat/run_vmstat_alert.ksh prodsid > /home/vmstat/v.lst
09 7 1 * * /home/vmstat/run_vmstat_weekly_alert.ksh prodb1
****************************************************************
# This is the daily iostat collector & report for the Remote DBAs and SAs
#****************************************************************
#00 7 * * * /home/iostat/run_iostat_solaris.ksh > /home/iostat/r.lst
#00 7 * * * /home/iostat/run_iostat.ksh prodsid > /home/iostat/v.lst
#****************************************************************
# This is the every 5 min. trace file alert report for the Remote DBAs
#****************************************************************
1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,
53,55,57,59 * * * * /home/mon/trace_alert.ksh prodsid > /dev/null
2>&1
#****************************************************************
# This code ensures that the daemon to check for buffer busy waits
# is always running.
#****************************************************************
30 7 * * * /home/mon/run_busy.ksh > /dev/null 2>&1
We also need to modify these reports to send
the information via e-mail to the appropriate person. The alert
reports are designed to spool the output to a known filename, and the
Remote DBA just needs to modify the commands that send the e-mail alert to
customize the recipients’ e-mail addresses.
Let’s look at how it works. The Korn shell code
tha follows checks the size of the alert report and mails the report
to the Remote DBA if alerts were detected by the script:
var=`cat /tmp/statspack_alert.lst|wc -l`
if [[ $var -gt 1 ]];
then
echo
"*********************************************************************"
echo "There are alerts"
cat /tmp/statspack_alert.lst|mailx -s "Statspack Alert" \
don@oracle.com \
larry_ellison@us.oracle.com \
james@us.oracle.com
echo
*******************************************************************"
exit
This is an excerpt from "Oracle9i
High Performance tuning with STATSPACK" by Oracle Press.
 |
If you like Oracle tuning, you may enjoy the new book "Oracle
Tuning: The Definitive Reference", over 900 pages
of BC's favorite tuning tips & scripts.
You can buy it direct from the publisher for 30%-off and get
instant access to the code depot of Oracle tuning scripts. |
 |
Expert Remote DBA
BC is America's oldest and largest Remote DBA Oracle support
provider. Get real Remote DBA experts, call
BC Remote DBA today. |
 |
|