rtieland
asked on
SID of current session?
Hi,
how do i get the current SID for the user connected to the Oracle database.
i know this can be done with mssql by the command @@SPID, what is the equivalent in oracle?
thanks in advance,
ruben
how do i get the current SID for the user connected to the Oracle database.
i know this can be done with mssql by the command @@SPID, what is the equivalent in oracle?
thanks in advance,
ruben
ASKER
Hi hayrabedian,
your solution doesn't work for me because there can be multiple sessions with the same username.
thanks though for your quick reply,
ruben
your solution doesn't work for me because there can be multiple sessions with the same username.
thanks though for your quick reply,
ruben
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
yes the solution from Ali is the right one :)
Just one detail:
You can use just:
SELECT USERENV('SESSIONID') FROM DUAL;
And no privileges are needed.
yes the solution from Ali is the right one :)
Just one detail:
You can use just:
SELECT USERENV('SESSIONID') FROM DUAL;
And no privileges are needed.
NO hayrabedian, they are different. Try it.
Ali
Ali
select user , global_name,
USERENV('TERMINAL') terminal,USERENV('SESSIONI D') sessionid
from global_name
USERENV('TERMINAL') terminal,USERENV('SESSIONI
from global_name
select user , global_name,
USERENV('TERMINAL') terminal,USERENV('SESSIONI D') sessionid
from global_name
USERENV('TERMINAL') terminal,USERENV('SESSIONI
from global_name
Hi,
Ali is right again:) I don't know why the "Auditing session ID" is returned by the USERENV('SESSIONID'), but we have to live with that.
Best regards,
Eddie
Ali is right again:) I don't know why the "Auditing session ID" is returned by the USERENV('SESSIONID'), but we have to live with that.
Best regards,
Eddie
SELECT USERNAME, SID, SERIAL#, PROGRAM FROM V$SESSION
WHERE AUDSID = USERENV('SESSIONID')
WHERE AUDSID = USERENV('SESSIONID')
SELECT SID
FROM v$session
WHERE username = user;
Note: this will return all session IDs for the current user.