Hi Dear list;

I don't have experience on NT scripting. but I have an urgent need for
nt script. Someone's help would be appreciated. Here is the question;
How to convert this script to nt script? I need to reboot the nt server
if there is any error on this sql statement instead of paging someone on
UNIX. 

Thanks a lot,

Joan

. $HOME/.profile

echo Sending mail!!!
dt=$(date '+%H%M_%m%d%y')
export ORACLE_SID=FMRPT
    sqlplus / <<EOF! > sqllog
   set heading off
    SELECT 'FMRPT PSNTRP02 SCHEDULER DOWN' FROM DUAL
  WHERE EXISTS (SELECT 'X' FROM PSSERVERSTAT
                     WHERE SERVERNAME = 'PSNTRP02'
                           AND SERVERSTATUS <> 3)
     OR NOT EXISTS (SELECT 'X' FROM PSSERVERSTAT
                     WHERE SERVERNAME = 'PSNTRP02')
UNION
SELECT 'FMRPT PSNTRP03 SCHEDULER DOWN' FROM DUAL
  WHERE EXISTS (SELECT 'X' FROM PSSERVERSTAT
                     WHERE SERVERNAME = 'PSNTRP03'
                           AND SERVERSTATUS <> 3)
     OR NOT EXISTS (SELECT 'X' FROM PSSERVERSTAT
                     WHERE SERVERNAME = 'PSNTRP03')
;
exit
EOF!
cat sqllog |egrep 'DOWN' > errfilelog
cat sqllog | egrep -q 'DOWN'
        if [ $? -eq 0 ]         # found at least one match
        then
         mailx  -s  'FMRPT P.SCHEDULER IS DOWN'  [EMAIL PROTECTED]<
errfilelog
         
 exit -1
        fi
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Joan Hsieh
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (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).

Reply via email to