The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
gcd.sh script doesn't work... kantze Shell Programming and Scripting 1 01-17-2008 05:46 PM
Modify Perl script to work with txt - Permissions script joangopan Shell Programming and Scripting 1 09-12-2007 08:38 PM
Script doesn't work, but commands inside work cheongww UNIX for Dummies Questions & Answers 2 11-14-2006 06:52 PM
Causing a disk to be corrupt Yummator UNIX for Dummies Questions & Answers 1 03-24-2004 07:36 PM
HTML is causing problems Perderabo Post Here to Contact Site Administrators and Moderators 4 06-04-2003 06:46 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-02-2006
Registered User
 

Join Date: Feb 2006
Posts: 14
Some env setting is causing the script not to work ?

Not sure what has changed in the Unix environment.
The following script which was working is now not working.

Code:
#!/usr/bin/ksh
# -----------------------------------------------------------------------------
# File:      monitor_db.sh
#
# -----------------------------------------------------------------------------
cd ~
. .profile

# Parameters used
# ORA_LOG,ORA_SCRIPT,DBA_EMAIL_LIST   -- (set in .profile)
#

cat $ORA_SCRIPT/orasid.lst | while read LINE1
do
  cat /etc/oratab | while read LINE
  do
  case $LINE in
  \#*)            ;;      #comment-line in oratab
  *)
  #       Proceed only if third field is 'Y'.
 if [ "`echo $LINE | awk -F: '{print $1}' -`" = $LINE1 ] ; then
 export ORACLE_SID=$LINE1
 export ORACLE_HOME=`echo $LINE | awk -F: '{print $2}' -`

#
# CHECK FOR ALL DB if Up/Down
#

  if [ -f $ORA_LOG/pmon_process_exist.txt ] ; then /bin/rm $ORA_LOG/pmon_process_exist.txt; fi
  ps -ef | grep ora_pmon_$ORACLE_SID | grep -v grep  > $ORA_LOG/pmon_process_exist.txt
  if [ -s $ORA_LOG/pmon_process_exist.txt ]
  then
        if [ -f $ORA_LOG/select.lst ] ; then /bin/rm $ORA_LOG/select.lst; fi
        $ORACLE_HOME/bin/sqlplus -s ora_connect/ora_connect@$ORACLE_SID @$ORA_SCRIPT/select.sql
        if [ -s $ORA_LOG/select.lst ]
        then
                echo "DB ALL OK"
        else
        for dba in `cat $ORA_SCRIPT/DBA_EMAIL_LIST`
        do
                /usr/bin/mailx -s "PMON is up but DATABASE HAS CONNECTIVITY ISSUES: $ORACLE_SID" $dba < /dev/null
        done
        fi
  else
    for dba in `cat $ORA_SCRIPT/DBA_EMAIL_LIST`
    do
        /usr/bin/mailx -s "DATABASE IS DOWN: $ORACLE_SID" $dba < /dev/null
    done
  fi
  rm $ORA_LOG/pmon_process_exist.txt
 fi
esac
done
echo $LINE1
echo $ORACLE_SID
echo $ORACLE_HOME
done

This is the culprit.
Code:
ps -ef | grep ora_pmon_$ORACLE_SID | grep -v grep  > $ORA_LOG/pmon_process_exist.txt
For some reason this is now generating an empty file thus making the logic fto ail and eventually the purpose of script. So even if the pmon process is not up it thinks it is since the file exist ? ANy idea of what have happened that all of a suddent the same script is not working ?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-02-2006
Registered User
 

Join Date: Feb 2006
Posts: 14
Code:
ps -ef | grep ora_pmon_abc | grep -v grep
ps -ef | grep ora_pmon_abc | grep -v grep > abc
cat abc
An empty abc file was created ? don't know why...It was not the case before ?

Code:
ps -ef | grep ora_pmon_mdmop | grep -v grep
  oracle  6778     1  0  Mar  1  ?         0:19 ora_pmon_mdmop
ps -ef | grep ora_pmon_mdmop | grep -v grep > abc
cat abc
  oracle  6778     1  0  Mar  1  ?         0:19 ora_pmon_mdmop
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:27 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0