Which session I'm in?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 9 of 9

Thread: Which session I'm in?

  1. #1
    Join Date
    Dec 2000
    Posts
    87
    Hi all,

    How am I able to know which session_id I'm currently in if there are several users log in with the same oracle username, and using the same application?
    Thanks a lot.

  2. #2
    Join Date
    Jan 2001
    Posts
    642
    Query on v$session & v$session, It gives you the info about the users login, and process they are doing.

    Badrinath

  3. #3
    Join Date
    Feb 2001
    Posts
    184
    Hi,
    If there are many users logged in as one name that normally happens in Development. Here is a way to find out.

    Select userenv('terminal') from dual; It Gives you the Terminal
    Select userenv('sessionid') from dual; -- This gives you the session id... If want more find here

    select audsid sessiond, OSUSER, MACHINE, TERMINAL, PROGRAM from v$session
    where audsid = (select userenv('sessionid') from dual)

    Hope this will help.

    Thanks.

  4. #4
    Join Date
    Dec 2000
    Posts
    87
    Thanks all.
    Oracledba8, what does the function 'userenv' do? Thanks.

  5. #5
    Join Date
    Feb 2001
    Posts
    184
    Thats' what you are getting.
    It can give you the Terminal Id that you are working on , your Session id, The language you are using etc.

    It's just like User Environment...

    Thanks.

  6. #6
    Join Date
    Dec 2000
    Posts
    87
    I think I supposed to ask the question the other way round.
    What is audsid, and what's the difference between it and sid?

  7. #7
    Join Date
    Nov 2000
    Posts
    212
    audsid seems(I never found specification on that) to be different for every new session: at least our app. heavily relies on this fact and never failed yet.

    sid's are reused. In fact, only pair <sid , serial#> seems to be unique. A proof: both of them are used in 'alter system kill session'

    quering v$session on sid is much faster(at least not expensive in memory terms) as index is used, this is not a case for ausid.

  8. #8
    Join Date
    Nov 2000
    Posts
    212
    in last answer there is a typo:

    "sid's are reused. In fact, only pair {sid, serial} seems to be unique"

  9. #9
    Join Date
    Nov 2000
    Posts
    22
    select sid from v$mystat where rownum=1;

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