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.
Printable View
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.
Query on v$session & v$session, It gives you the info about the users login, and process they are doing.
Badrinath
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.
Thanks all.
Oracledba8, what does the function 'userenv' do? Thanks.
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.
I think I supposed to ask the question the other way round.
What is audsid, and what's the difference between it and sid?
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 pairseems 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.
in last answer there is a typo:
"sid's are reused. In fact, only pair {sid, serial} seems to be unique"
select sid from v$mystat where rownum=1;