Re: How to use tnsping programmatically

From: joel garry <joel-garry_at_home.com>
Date: Wed, 8 Apr 2009 11:58:12 -0700 (PDT)
Message-ID: <90613d3b-0c55-4f8d-950c-2be40675c213_at_l1g2000yqk.googlegroups.com>



On Apr 8, 6:43 am, "Strange Cat _at_ Work" <du..._at_dummy.com> wrote:
> > You can call tnsping from a shell script or a program, but how often
> > are you planning on running this check?
> > How often were you running your last check that managment or the
> > network team asked you not to run?
> > There is generally no real need to continuously check to see if the
> > database is there.  If the database is not there you will know in
> > fairly short order when the phone calls start coming in.  From within
> > an application you can just check the return code on the connect
> > call.  If the connect fails you will get an error code and you can
> > pass this on to an alert system (feature) to provide the database down/
> > unreachable error information.

I think the idea is to get to work on it before the phones light up :-)

>
> Thanx for answering Mark,
>
> the need is to avoid attempting the connection if the Oracle instance
> appears to be unreachable. We're developing a panel pc app that has to
> connect to an Oracle server on demand (user touching screen and booking for
> canteen).
>
> Problem is that the Oracle server happens to be on the other side of the
> mountains (and this is for real, no joke) and we've been warned about lack
> of connectivity/bandwidth on this connection.
>
> So, to make a long story short, what i'm trying to do is avoid connection
> (and users waiting for a timeout to occur in front of pc) if Oracle is not
> tnspingable...
>
> Other ideas are welcome, of course :)

Just thinking out loud:

If your systems are on unix, watch for the process, send periodic heartbeats, try connection if heartbeat lost. Like:

while `ps -ef|grep dbw0_$ORACLE_SID|grep -v grep` do

        sleep 60
        echo "put date/time via rcp or mail here"
done
echo "THE FLOOD WATERS ARE RISING!!!"

And of course, do whatever the heck you want on the monitoring side.

If not on unix, email heartbeat from Oracle, deal with possibilities when you don't get it.

EM has alerts, why not just use those? It emails me when it can't get to the agent, which means something wrong. If your net is so unreliable you can't get email, you need more basic monitoring than at the oracle level.

The old Big Brother used to use simple scripts to generate statistics on the monitored side, and simple browser scripts to check those files on the monitor side. Haven't checked in a while if that stuff is still around.

jg

--
_at_home.com is bogus.
http://www.computerworld.com.au/article/298623/mammoth_digital_array_blasts_star_trek_australian_premiere
Received on Wed Apr 08 2009 - 13:58:12 CDT

Original text of this message