Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Session Ip Address
Mark D Powell wrote:
> select sys_context('USERENV','ip_address') from sys.dual;
>
> You could use a database event logon trigger to store the client ip in
> v$session via dbms_application_info or save the data elsewhere where
> the Oracle username logging on is of interest.
... another option is to query the MACHINE column in V_$SESSION and do the DNS resolution to IP address outside Oracle (from perl, Java or whatever). The example Unix shell script below works for me on Linux and Solaris to list the distinct host names and IPs connected to a given Oracle server:
#------- Cut here ------ #!/bin/csh # Get machine names connected to Oracle and their IPs # Replace USER, PASSWD and SID below
Mark's solution is far easier if all you need is the IP
for the current session, as opposed to
all the IPs connected across the entire instance.
Cheers,
JH Received on Thu Jan 04 2007 - 09:14:22 CST