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

Home -> Community -> Mailing Lists -> Oracle-L -> nt script

nt script

From: Joan Hsieh <joan.hsieh_at_tufts.edu>
Date: Fri, 07 Mar 2003 08:24:24 -0800
Message-ID: <F001.00563570.20030307082424@fatcity.com>


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'  xxxx_at_skytel.com<
errfilelog
         
 exit -1
        fi

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Joan Hsieh
  INET: joan.hsieh_at_tufts.edu
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: 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). Received on Fri Mar 07 2003 - 10:24:24 CST

Original text of this message

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