Search code examples
javaoracle-databasesid

How to obtain a list of SID's on a machine in Java Application


I am attempting to look up the list of SID's on a host. I have the host, port, username and password for Oracle and I want to find out the SID's on the machine.

I am able to logon to the machine and use "lsnrctl status" to return the SID's however when I try to run this through my java application it is unsuccessful. This is due to the Oracle version:

From 10g oracle default has Security ON: Local OS Authentication meaning that only the local OS user that started the listener can issue lsnrctl commands to the listener. The listener will refuse to answer any other user.


Solution

  • I found a way to do this. You can give the listener a password which allows the listener to talk to users who are authenticated via Local OS Authentication or via the password - my java application can use the password to authenticate by passing the password as part of the STATUS connect_data.

    Source: http://www.dba-oracle.com/t_listener_password_security_lsnrctl.htm