Re: determining if a remote db is up or down

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 13 Jan 2003 11:50:41 -0800
Message-ID: <92eeeff0.0301131150.17b3fdde_at_posting.google.com>


rarora_at_metasolv.com (Raj A) wrote in message news:<417959c3.0301130758.4cc273e8_at_posting.google.com>...
> Does anyone know a simple method of determing if a remote db is up or
> down which can be instrumented from a shell script.
>
> I've looked at using tnsping but it only tells me if the listener is
> up.
>
> I've been looking at making a sqlplus cmd but can't figure out how to
> make the call in a single line and have it complete with a successful
> or fail message for the connection.
>
> Can anyone advise.
>
> rarora_at_metasolv.com
> raj arora

  1. Windows NT/2K/XP C:> echo exit|sqlplus user/password_at_service|findstr /i "ORA- TNS- LRM-" >nul C:> echo %errorlevel% If %errorlevel% returns 0 then unable to connect.
  2. Unix $ echo exit|sqlplus user/password_at_service|grep -i "ORA- TNS- LRM-" >nul $ echo $? If $? returns 0 then unable to connect.

You can further qualify findstr and grep with exact exception message.

Regards
/Rauf Sarwar Received on Mon Jan 13 2003 - 20:50:41 CET

Original text of this message