Script multi listener

hello

can help to script to find the listener is up or down for diferent db

i have 2 listener

ps -fea |grep tns   
    root 17333 17559  0 12:26:38 pts/3    0:00 grep tns
  oracle  3800     1  1   Jul 23 ?       400:42 /u01/app/oracle/product/9.2.0/bin/tnslsnr LISTENER -inherit
  oracle  4943     1  1   Jul 23 ?       690:37 /u01/app/oracle/product/10.2.0/bin/tnslsnr LISTENER_10G -inherit

i have 5 db

bd1 version 9 LISTENER
bd2 version 9 LISTENER
bd3 version 9 LISTENER
bd4 version 10 LISTENER_10G
bd5 version 10 LISTENER_10G

with Os Solaris

Thanks!

I cannot give you a direct solution. By that I mean sample code.
Why? Because there are too many ways and too many possible locations to set up.

$ORACLE_HOME/bin/tnsping tells you if a given listener is up - the listener being the one for that given ORACLE_HOME [9i or 10g]. You must execute this on a box that is not the same as the db server zone or server. Example: your desktop PC with Oracle client installed, or an application Solaris zone that has Oracle client installed.

Set your environment to either 10g or 9i by directing ORACLE_HOME to the correct value, then

execute in a script or from the command line:

DB=[name of any one of your 9i dbs]
# or
DB=[name of any one of  10g dbs]
[set environment to the right ORACLE_HOME]
# test the resulting return code 0 == OK 
tnsping $DB
if [ $? -ne 0 ] ; then
   echo " Oracle listener connection failed. DB or listener is down"
fi

Note that db's of a given version, like Oracle 9i, share one listener.