Home » RDBMS Server » Server Administration » Urgent requirement, need Paging script
Urgent requirement, need Paging script [message #57261] Sat, 31 May 2003 06:13 Go to next message
sidd
Messages: 130
Registered: May 2003
Senior Member
Guy I need to write a script that pages admin, in case server runs out off disk space or a transaction fails, in oracle 8i and hp UNIX. This is an urgent requirement. Please help me.
Re: Urgent requirement, need Paging script [message #57267 is a reply to message #57261] Sat, 31 May 2003 22:56 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
# there are many methods to do this.
# this is the one i use in my production
export ORACLE_SID=yoursid
export MAILLIST="someemailid"
export MAILLIST_F="somepagerno" #like 1234@skytel.com
export SERVER=`uname -n`
$ORACLE_HOME/bin/sqlplus <<EOF

#  
#include your sql statement or procedure or anything
#Make sure create a  file in which an entry or any errors are written. 
#let the logfile be /u01/app/oracle/product/log
exit
EOF
#
# here i am intrested in a particular error message "error message stack follows"
# this error message is related to rman backups. YOU can CHOOSE ANY MESSAGE you want
# if the error i am looking for is located in the logfile i create a new file alert
cd /u01/app/oracle/product/log
grep "error message stack follows" log > alert
#
# so, now if there is some entry in the file alert, it means, something is wrong. else everything is cool.
# according to your need, you can handle this
# in this example , if everything is OK a regular email is sent to me.
# if there are any errors a the message is paged to me and an email is sent
# here i am doing in two steps ( emails and pager lists are seperate).
# Mine is a different case ( a little complex notification standards we follow)
# you can simplify the following into single step ( one if-then-else, insttead of two if statements)
if test -s alert
then
mailx -s "There is a problem with RMAN backup of the database on $SERVER" $MAILLIST <<EOF
Please Check RMAN backup log in the directory 'xxxxxxxx' for further information.
EOF
#
else
mailx -s "RMAN backup of the database on $SERVER is succesfully completed" $MAILLIST <<EOF
NONE
EOF
fi
##to send the pager
if test -s alert
then
mailx -s "There is a problem with RMAN backup of the database on $SERVER" $MAILLIST_F <<EOF
Please Check RMAN backup log in the directory 'xxxxxxxxxxx' for further information.
EOF
fi

#and ofcourse, schedule this script as cron job
#to do a regular sweep

----------------------------------------------------------------------

or to do within oracle

----------------------------------------------------------------------

create a stored procedure to do the job.
schedule that stored procedure to be executed in regular intervals using DBMS_JOB.
grab the messages ( you can use UTL_FILE to create logfiles )and send emails from oracle using 
UTL_SMTP. As a pre-requisite, you need to configure Oracle JVM for this by running initjvm.sql

Re: Urgent requirement, need Paging script [message #57270 is a reply to message #57261] Sun, 01 June 2003 08:11 Go to previous message
pwl
Messages: 22
Registered: May 2000
Junior Member
Sidd,
I wonder if the first part of your problem (running
out of disk space) refers to Oracle Tablespaces
running out of space. If this is true then make them
autoextend, with a maximym size allowed by the Unix.
This will stop any nasty surprises due to the system
running out of space, and you will be able to sleep
through the night knowing that Oracle will get more
space when and if it need to.
Now you will be able to run a job once a day to check
on disk availability at the mount point.
df -k for example.
If the % unused falls below some predetermined figure
(you will need to monitor growth on the database)
then and only then must you act to add extra files to
the growing tablespace(s).
If the system is OLTP, then you might chose to extend
the growing tablespaces by a suitable number of
blocks at a convenient time (when its quiet). For
batch based systems it usually is best to just let
oracle get on with it.
Previous Topic: Problem in Adding a datafile
Next Topic: How to restart OracleTNSListener80 service.
Goto Forum:
  


Current Time: Fri Sep 20 11:36:49 CDT 2024