Re: How to use tnsping programmatically

From: Michael Austin <maustin_at_firstdbasource.com>
Date: Wed, 08 Apr 2009 13:12:08 -0500
Message-ID: <4O5Dl.25694$yr3.2334_at_nlpi068.nbdc.sbc.com>



Michel Cadot wrote:
> "Strange Cat _at_ Work" <dummy_at_dummy.com> a écrit dans le message de news: 49dcaa04$0$1121$4fafbaef_at_reader1.news.tin.it...
> |> 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.
> |
> | 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 :)
> |
> | > HTH -- Mark D Powell --
> |
> | Thanx again
> | Paolo
> |
>
> Being tnspingable does not mean instance is reachable, just listener is.
> Why not just try to connect ?
>
> Regards
> Michel
>
>

exactly - tnsping is no more network intensive as a connect/disconnect - not enough to matter anyway... unless you are trying to reconnect every second.. You could also configure tcpip to have a shorter timeout on the client.
see: http://support.microsoft.com/kb/170359

 From an application standpoint, why not use something that has a connection pool where it "stays" attached by pinging dual (select * from dual every n-minutes). However, given your explanation of unreliable connections, this still in no way will guarantee the connection will be available/usable when the person walks up to the kiosk n-seconds later. Received on Wed Apr 08 2009 - 13:12:08 CDT

Original text of this message