Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: db up script

Re: db up script

From: Rocky Welch <rockyw_99_at_yahoo.com>
Date: Fri, 12 May 2000 10:43:12 -0700 (PDT)
Message-Id: <10495.105542@fatcity.com>


--0-424238335-958153392=:13190
Content-Type: text/plain; charset=us-ascii Content-Disposition: inline

Hi Lisa,
I snagged this one this morning.

HTH,


Rocky Welch
Oracle DBA Consultant

rockyw_99_at_yahoo.com



Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger. http://im.yahoo.com/
--0-424238335-958153392=:13190
Content-Type: text/plain; name="dbup.txt"
Content-Description: dbup.txt
Content-Disposition: inline; filename="dbup.txt"

Oracle Newsgroup for rockyw_99_at_yahoo.com     Yahoo! - My Yahoo!     Options - Sign Out - Help  
 
  Mail       Addresses       Calendar       Notepad     
 
 

Yahoo! FinanceVision - streaming financial news from silicon valley      

    as attachmentinline text Download Attachments

       Next | Oracle Newsgroup - Choose Folder -[New Folder]InboxDBI Newsgroupbamatechsaved Date: Fri, 12 May 2000 07:01:28 -0800
To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> Reply-to: ORACLE-L_at_fatcity.com
From: Thomas Jeff <ThomasJe_at_tce.com> | Block address Subject: RE: db up script
Organization: Fat City Network Services, San Diego, California

        Add Addresses  

This is a slightly changed version of a script that Steve Adams posted a
while back,
I have an AUTOSYS job that runs this every 15 minutes. It checks for both
a
hung/db not up, and excessive TNSPING times.

#! /usr/bin/ksh
export
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/sbin:/export/home/oracle:. export ORACLE_HOME=/oracle/app/oracle/product/7.3.4 export PATH=$ORACLE_HOME/bin:$PATH
export THRESHOLD=1000
export STATUS=0;
export TWO_TASK=db1.world
export SPOOL=/tmp/$$.SPOOL
export PING=/tmp/$$.PING
export TNS_ADMIN=/etc

echo ' ' >> /tmp/$TWO_TASK.dbcSUCCESS
tnsping $TWO_TASK | tail -1 > $PING &

sleep 1
((timeout = 20))
while ((timeout -= 1)) && ! grep -c OK $PING >/dev/null do

   sleep 1
done

if [[ `grep -c OK $PING` = 1 ]]
then

   echo `date` $TWO_TASK 'is responding to TNSPING' >> /tmp/$TWO_TASK.dbcSUCCESS

   TIME=$(sed -n 's/.* (\([0-9]*\) .*/\1/p' $PING)    if (($TIME > $THRESHOLD))
   then

      echo `date` 'TNSPING' $TIME 'msec is excessive' > /tmp/$TWO_TASK.dbcFAILED.$$

      STATUS=1
      exit $STATUS
   else
      echo `date` 'TNSPING is' $TIME 'msec' >> 
/tmp/$TWO_TASK.dbcSUCCESS
  fi
else

   kill $!
   echo `date` $TWO_TASK 'is not responding to TNSPING' > /tmp/$TWO_TASK.dbcFAILED.$$

   STATUS=1
   exit $STATUS
fi

sqlplus -s << EOF > $SPOOL
nobody/important
exit;
EOF
egrep 'ORA-122|ORA-121|ORA-01034' $SPOOL > /dev/null if [[ $? = 0 ]]
then

   echo `date` $TWO_TASK 'is NOT accessible' > /tmp/$TWO_TASK.dbcFAILED.$$

   STATUS=1
   exit $STATUS
else

   grep 'ORA-01017' $SPOOL > /dev/null
   if [[ $? = 0 ]]
   then
     echo `date` $TWO_TASK 'is UP and accessible' >> /tmp/$TWO_TASK.dbcSUCCESS

   fi
fi

rm $SPOOL
rm $PING

-----Original Message-----
Sent: Thursday, May 11, 2000 1:29 AM
To: Multiple recipients of list ORACLE-L

Hello -

Does anyone have a script that checks if a series of databases are up and
available that they would be willing to share? I set out to write a ksh
script
to do this and found that I would have to write C to do what I needed to do,
since trying to connect to a hung or down instance will result in a hung
process. There wasn't an easy way to fire off the connect process, sleep,
and
kill it if it hadn't come back yet. I really don't want to spend my day
writing
C code, it will exacerbate the headache my job gave me today.

Any suggestions / script snippets are appreciated Thanks
Lisa

-- 
Author: 
  INET: Lisa_Koivu_at_gelco.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Author: Thomas Jeff
  INET: ThomasJe_at_tce.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
        Next | Oracle Newsgroup   - Choose Folder -[New Folder]InboxDBI Newsgroupbamatechsaved   
    as attachmentinline text  Download Attachments  


Yahoo! Messenger - Send instant messages to your online friends.  
Address Book 7 Alerts 7 Auctions 7 Bill Pay 7 Bookmarks 7 Briefcase 7 Broadcast 7 Calendar 7 Chat 7 Classifieds 7 Clubs 7 Companion 7 Games 7 GeoCities 7 Greetings 7 Invites 7 Mail 7 Maps 7 Member Directory 7 Messenger 7 My Yahoo! 7 News 7 People Search 7 Personals 7 Photos 7 Shopping 7 Sports 7 Stock Quotes 7 TV 7 Travel 7 Weather 7 Yahooligans 7 Yellow Pages 7 more...  
Received on Fri May 12 2000 - 12:43:12 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US