Wednesday, 27 May 2020

Crontab - Check database Instance status on mail

Crontab Details:

5,10,15,20,25,30,35,40,45,50,55,00 * * * * /u04/MasterDB/scripts/prod_check_instance.sh > /u04/MasterDB/scripts/prod_check_alert_monitor.log 2>&1


Script Details:

oracle@test02:~> cat /u04/MasterDB/scripts/prod_check_instance.sh

#!/bin/sh

SERVICE=ora_pmon_PRODB

#replace ‘orcl’ with your sid

DBALIST="core@abc.com";export DBALIST

if ps -ef | grep -v grep | grep $SERVICE > /dev/null

then

#echo "$SERVICE service running, everything is fine" | mailx -s "database prodb DR on `hostname` is up" $DBALIST

#echo "Alert" | mailx -s "database prodb DR on `hostname` is UP" $DBALIST

else

echo "$SERVICE is not running contact DBA " $DBALIST | mailx -s "database prodb Production database 64 on `hostname` is down" $DBALIST

#echo "Alert" | mailx -s "database prodb DR on `hostname` is down" $DBALIST

fi


oracle@test02:~>

No comments:

Post a Comment