DBAsupport.com Forums - Powered by vBulletin
Results 1 to 7 of 7

Thread: How to find IP Address of Clients

  1. #1
    Join Date
    Dec 2005
    Posts
    19

    How to find IP Address of Clients

    Hi,

    I am useing oracle 8i on sun solaris and clients are of windows

    when quering v$session it gives many details but does not gives the IP_Address of the clients.


    How to get the IP_Address of the clients.


    Regards

    Arun Tayal

  2. #2
    Join Date
    Jan 2001
    Posts
    2,828
    Hi

    SELECT sys_context('USERENV', 'OS_USER') FROM dual;

    If the client uses a middle tier then the ip address of the middle tier is returned.

    regards
    Hrishy

  3. #3
    Join Date
    Dec 2001
    Posts
    320
    Hi,
    SELECT SYS_CONTEXT('USERENV','IP_ADDRESS') "My IP Address" from dual;

    For more details refer to Metalink Note: 120797.1

    Regards.
    Anyone can hold the helm when the sea is calm.

  4. #4
    Join Date
    Feb 2006
    Posts
    37
    TRY THIS. IT WILL GIVE YOU THE ENTIRE LIST OF IP'S FOR ALL LOGONS

    select AU.userid ,
    substr(AU.comment$text, 68,21) as "Host / IP_ADDRESS"
    from sys.aud$ AU
    where to_char(AU.timestamp#, 'DD-MON-YY') IN ('24-APR-06')

  5. #5
    Join Date
    Feb 2006
    Posts
    37
    This one may be better:

    select /*+ ROWID (sys.user_audit_session) */
    SU.OS_USERNAME,
    substr(AU.comment$text, 68,21) as "Host / IP_ADDRESS",
    ua.TIMESTAMP,AU.entryid,AU.timestamp#,AU.userid,AU.action#,UA.action_name,
    from sys.aud$ AU, sys.DBA_AUDIT_TRAIL UA,
    sys.DBA_audit_session SU
    where AU.action# = '100' and
    to_char(AU.timestamp#, 'DD-MON-YY') IN ('24-APR-06')
    and AU.sessionid = UA.sessionid
    and SU.sessionid=UA.sessionid
    order by timestamp DESC

  6. #6
    Join Date
    Dec 2005
    Posts
    19
    Hi,

    Thanks for your replies.

    But I am not able to find any records in table sys.aus$.
    I had logged in as sys also but still shows "no records found"


    Also SYS_CONTEXT('USERENV','IP_ADDRESS') will give the IP_Address of the current user not all the users connected.

    Please help.

    Arun Tayal

  7. #7
    Join Date
    Jan 2001
    Posts
    2,828
    Hi

    You can try simply

    select sys_context('username' ,'ip_address')
    from v$session
    where username='Your-friends-name'

    for the sys.aud$ queries to work you shoud

    audit_trail=DB in the init.ora and then bounce the database

    regards
    Hrishy
    Last edited by hrishy; 04-25-2006 at 04:41 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width