Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Mailing Lists -> Oracle-L -> RE: How to find a listener service without running lsnrctl servic

RE: How to find a listener service without running lsnrctl servic

From: Rao, Maheswara <>
Date: Thu, 22 Feb 2001 00:42:18 -0800
Message-ID: <>


This problem is solved thanks to Chuck Hamilton suggestion. I thank all the list members who took their time in suggesting the solution.

Following is the solution given by Chuck Hamilton.

You can do what you want by using the setuid bit. On some version of unix you may need a kernel parameter change to allow shell scripts to run with the setuid bit turned on.

  1. Log in as the "oracle" user.
  2. Remove the password from the shell script and put it into a separate file protected with unix permissions. echo "mypassword" > listener.pass chmod 600 listener.pass # Now only "oracle" can read this file
  3. Change the line in your shell script to read the password from the listener.pass file. For KSH something like this works. lsnrctl <<! | grep ORCL # (or whatever service you're looking for) set password $(<listener.pass) status !
  4. Change the permission on the shell script and add the setuid bit. This causes the run-time user id to be set to the owner of the shell script
    (which should also be "oracle").
    chmod u+s or chmod 4755

Any user can now run the script, and even read the script, but can't see the password because he can only cat the script, not the password file.

Thank You Chuk Hamilton.


Hi DBAs,

I would like to find out whether a specific listener service is up or not without running the command ---> lsnrctl services. Is there any way I can do this through a shell script or unix command?

My environment : Solaris 2.7 : Oracle 8.0.4

Thanks for your help,


Please see the official ORACLE-L FAQ:
Author: Rao, Maheswara

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: (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).
Received on Thu Feb 22 2001 - 02:42:18 CST

Original text of this message