Re: Vs: Re: Server IP Address and Listener Port
Date: Thu, 11 Sep 2008 19:27:45 -0600
Message-ID: <cf3341710809111827u5fcea695ld9f0a08b3c4dc31f@mail.gmail.com>
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_at_edita.fi>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_at_gmail.com> 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_at_gmail.com> 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
> >
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>
-- Cheers, -- Mark Brinsmead Senior DBA, The Pythian Group http://www.pythian.com/blogs -- http://www.freelists.org/webpage/oracle-lReceived on Thu Sep 11 2008 - 20:27:45 CDT