Raj,

excuse my ignorance of all things shell script like, but when I try to run
this I keep getting the error "CHECK_CONNECT=$$.CHECK_CONNECT: is not an
identified." any thoughts on this one.

Regards,
Kev.

"hit any supermassive black hole to continue"
__________________

Kevin Thomas
Technical Analyst
Deregulation Services
Calanais Ltd.
(2nd Floor East - Weirs Building)
Tel: 0141 568 2377
Fax: 0141 568 2366
http://www.calanais.com


-----Original Message-----
Sent: 18 September 2001 20:30
To: Multiple recipients of list ORACLE-L


Check out the following script.

*************** SCRIPT STARTS
HERE*********************
#!/usr/bin/sh 
############################################################################
###########
#
#       Auther                  : Raj Sakthi
#       
#       Modification History    : 
#               02/23/01        : Network Connectivity Checking was added
.               
#
#               *** THIS SCRIPT CHECKS FOR THE AVAILABILITY OF
INSTANCE ALONG WITH THE **** 
#               ***                     NETWORK CONNECTIVITY           
              ****
#
#                       Usage           :  Pass SID as parameter.  
#                 Example       :  sid_run orcl
# 
############################################################################
############
export CHECK_CONNECT=$$.CHECK_CONNECT
export READY=$$.ready
SID=$1
rm -f $READY
print "
 connect a/aa@$SID
  host touch $READY
 exit " |
 sqlplus /nolog  > $CHECK_CONNECT &
#
# Next we use a timer to check the sqlplus
hanging.........
#----------------------------------------------------------------
((timeout = 60))
while ((timeout -= 1)) && [[ ! -r $READY ]]
    do
        sleep 1
    done
#
# If the file Doesn't exist then we check for internal
connectivity ..............
#---------------------------------------------------------------------------
-----
if [  ! -f $READY ]
  then
         print "
         connect internal
         exit " |
         sqlplus /nolog > $SID_connect.log
         egrep 'Connected' $SID_connect.log >
/dev/null
      if [ $? = 0 ]
         then
         echo " Problem in Network connectivity of
$SID "
         else
         echo " Instance $SID is not responding "
#
# Here we decide that Database is unavailable Due to
SQLPLUS hanging ......... 
#---------------------------------------------------------------------------
----
         exit 86
      fi
fi 
   egrep 'ORA-01034|ORA-12224|ORA-12154'
$CHECK_CONNECT > /dev/null
if [[ $? = 0 ]]; then
   echo "Instance '$SID' is NOT accessible, or invalid
ORACLE_SID"
   rm $CHECK_CONNECT
   rm $READY
#
# Here instance is not available....staight and
simple..: )
#---------------------------------------------------------------------------
--
   exit 86
else   
#
# Check for INSTANCE availability by the specific
ORACLE error..........slick ..eh?!
#-------------------------------------------------------------------------
   grep 'ORA-01017' $CHECK_CONNECT > /dev/null   
  if [[ $? = 0 ]]; then
      echo "Instance '$SID' is UP and Accessible"     
     
   else   
#
#To catch any other  error .....
#
      echo "Instance '$SID' is HAVING UNKNOWN ERROR.
\n Verify Instance internal state "
   fi 
fi
rm $CHECK_CONNECT
rm $READY
**************** END  ************************
regards,
RS


--- Barry Deevey <[EMAIL PROTECTED]> wrote:
> Hi all, 
> 
> I am trying to write a script in unix that
> determines if a specific oracle
> instance is available. I'm trying to avoid using the
> 'ps' command, so I
> thought the easiest method would be to connect via
> sqlplus - If it connects
> its up, if it doesn't then its unavailable. However,
> the problem is that
> when it isn't up, the script hangs and does not
> return anything - I think
> that this is because sqlplus by default gives you 3
> attempts to logon, so
> even though the logon attempt failed, it is waiting
> for you to try again, so
> unfortunately I'm not getting a failed return code. 
> If anybody could tell me how to change this so that
> it only allows 1 login
> attempt before 'kicking you out' or whether there is
> a better method to
> finding out the status of an instance, I would be
> extremely grateful to hear
> from you. 
> 
> TIA for any responses. 
> 
> Best Regards, 
> Barry. 
> 
> 
> -- 
> Please see the official ORACLE-L FAQ:
> http://www.orafaq.com
> -- 
> Author: Barry Deevey
>   INET: [EMAIL PROTECTED]
> 
> 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: [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).


__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Sakthi , Raj
  INET: [EMAIL PROTECTED]

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: [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).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Thomas, Kevin
  INET: [EMAIL PROTECTED]

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: [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