|
 |
|
ss
Oracle Tips by Burleson |
Web Server Alert Report
In a production Web environment, it is often useful to alert the
staff whenever an Oracle-related program aborts. This script is
generally executed via a cron every five minutes, and this code can
be extended to locate core or trace file in any UNIX file location.
IN this example, the webserver_alert.ksh script can be customized to
search the dump file location for any Pro*C, C++, or perl programs.
This script requires the following modifications:
* Change the e-mail addresses to match the people who want to be
notified of program dumps.
* Change /usr/src/asp/core to the name and location of core files on
your Web server.
This is a simple but quite important script. It searches for a core
file and instantly e-mails it to alert the staff about a production
abort.
webserver_alert.ksh
#!/bin/ksh
MYDATE=`date +"%Y%m%d"`
SERVER=`uname -a|awk '{print $2}'`
if [ -f /usr/src/asp/core ]
then
# Move the file to a dated location . . .
mv /usr/src/asp/core /tmp/core_$MYDATE
# send an e-mail to the administrator
head /tmp/core_$MYDATE|\
mail -s "EMERGENCY - WebServer $SERVER abort in /tmp/core_$MYDATE"\
don@burleson.cc\
omar@oracle.com\
carlos@oracle.com
fi
As we see, this type of script instantly alerts Oracle developers of
the presence of trace file, and e-mails them the information that
they need to solve the production problem. Next, let’s look at a
real-time alert script that can warn the DBA about impending
problems in the Oracle environment.
Download your Oracle scripts now:
www.oracle-script.com
The
definitive Oracle Script collection for every Oracle professional DBA
|
|