#! /bin/ksh # # To verify if all instances mentioned in /etc/oratab are up and # all instances up are in /etc/oratab # # Biju Thomas - 06/04/98 # # # Initialize log file # export wlogfile=/tmp/compare_sid_db.log echo "**********************************************************************" > $wlogfile # #DBLIST=`ps -ef | grep pmon | awk '{print ($8) }' | cut -c10-` DBLIST=`ps -ef | grep pmon | grep -v "grep pmon" | cut -f3 -d_` SIDLIST=`grep -v '^\#' /etc/oratab | cut -f1 -d:` for dbname in $DBLIST do if [ `echo $SIDLIST | grep -c $dbname` -eq 0 ] then if [ `echo $dbname | grep -c OR` -eq 1 ] then echo "The instance $dbname is not available in /etc/oratab" >> $wlogfile echo "Backups and other monitoring will not be done for this database" >> $wlogfile fi fi done for sidname in $SIDLIST do if [ `echo $DBLIST | grep -c $sidname` -eq 0 ] then echo "The instance $sidname is available in /etc/oratab" >> $wlogfile echo "But the instance is not up and running." >> $wlogfile echo "Please remove or comment out entry in /etc/oratab" >> $wlogfile fi done if test `cat $wlogfile | wc -l` -ne 1 then echo "**********************************************************************" >> $wlogfile echo "Date : "`date '+%m/%d/%y %X %A '` >> $wlogfile echo "Server : "`uname -n` >> $wlogfile echo "**********************************************************************" >> $wlogfile mailx -s "Database / Oratab Compare Errors" "tbiju@hotmail.com" > /dev/null < $wlogfile fi