Re: get other session's ip

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: Sat, 1 Aug 2009 07:03:16 -0700 (PDT)
Message-ID: <7e006e0a-7b2c-47f0-9cfc-d3216d10bcac_at_24g2000yqm.googlegroups.com>



On Aug 1, 4:25 am, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
> "kevin" <majun..._at_hotmail.com> a écrit dans le message de news: d2576cda-88c6-42b3-8771-0c03b8e2b..._at_u16g2000pru.googlegroups.com...
> |I can get my current session's ip with 'select sys_context
> | ('USERENV','IP_ADDRESS') FROM DUAL; '. How can I get other session's
> | ip?
>
> select sid, machine, utl_inaddr.get_host_address(machine) ip
> from v$session
> where type='USER' and username is not null
> /
>
> Regards
> Michel

On my systems the above query sometimes results in an ORA-29257 on INACTIVE sessions. I believe that the front-end client is no longer connected. Some filtering may be necessary if you are not seeking the information for a specific active session.

Also on some platforms you may need to filter out a leading domain name:
utl_inaddr.get_host_address(substr(machine,instr(machine,'\')+1)) ip

HTH -- Mark D Powell -- Received on Sat Aug 01 2009 - 09:03:16 CDT

Original text of this message