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.
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)
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.
Bookmarks