Re: Vs: Re: Server IP Address and Listener Port

  • From: "Mark Brinsmead" <pythianbrinsmead@xxxxxxxxx>
  • To: teijo.lallukka@xxxxxxxx
  • Date: Thu, 11 Sep 2008 19:27:45 -0600

Hmmm...  Looks like a clever trick.  I doubt that this will work in all
cases however.  I actually *have* managed database servers who have multiple
IP addresses, with multiple listeners, various listeners listening on
different (subsets of) IP addresses with different ports.  Don't ask why!

I really doubt you are every going to unwind a configuration like that from
inside the database -- unless maybe you use Java to talk to the OS.  (But a
C program or shell script would probably be easier.)

Best bet, I suspect (at least on UNIX-like platforms) is to find all
listener processes (e.g., "ps -ef | grep lsnr")  and then for each listener
process find or infer the corresponding "listener.ora" file, parse the file
...  blah blah blah.

Even going to this much trouble, I almost wonder whether there are not
bizarre and complex cases that this would not handle.  Remote listeners?  IP
forwarding?  NAT / Reverse NAT ?

On the other hand, somebody mentioned elsewhere in this thread (a
disconnected part, at least as I see it) a dictionary view.  I have not
looked to see what that view offers, but it *could* be surprisingly
effective for this job - or perhaps totally useless.  :-)

On Tue, Sep 9, 2008 at 10:46 PM, Teijo Lallukka <teijo.lallukka@xxxxxxxx>wrote:

> Hi!
>
> Server IP you would get with this:
>
> SELECT UTL_INADDR.get_host_address from dual;
>
> Look at:
>
> http://www.oracle-base.com/articles/misc/IdentifyingHostNamesAndAddresses.php
>
> I don't know about listener port... I think there could be a way to do that
> without parsing...
>
> -Teijo
>
> >>> "sol beach" <sol.beach@xxxxxxxxx> 10.9.2008 4:27 >>>
> If you are determined to do this from a procedure running inside Oracle,you
> should be able to use UTL_FILE to read listener.ora & then parse it.
> This presumes UTL_FILE can access the directory where listener.ora reside.
> Alternatively, I am sure it can be by a custom Java procedure.
>
> On Tue, Sep 9, 2008 at 5:46 PM, Bala <oratips@xxxxxxxxx> wrote:
>
> > Is there anyway to find out Server IP Address and Listener Port from
> within
> > an Oracle 10gR2 Database ?
> > Is it Possible at all ?
> >
> > Thanks for any all tips.
> > --
> > Bala Rao
> >
>
> --
> //www.freelists.org/webpage/oracle-l
>
>
>


-- 
Cheers,
-- Mark Brinsmead
Senior DBA,
The Pythian Group
http://www.pythian.com/blogs

Other related posts: