Is there any way to uniquely identify current session in GV$SESSION
view in Oracle?
I've faced with the problem that the following query may return more than one row in case of Oracle RAC configuration:
SELECT SID, SERIAL#
FROM GV$SESSION
WHERE AUDSID = Sys_Context('USERENV', 'SESSIONID')
AND SID = Sys_Context('USERENV', 'SID');
Using V$MYSTAT
is not an option either, because V$MYSTAT
may not be accessible for the current session (for example when statistic is disabled).
AUDSID
plusSID
is not unique in case of Oracle RAC (only combination ofSID
andSERIAL#
is unique) andV$MYSTAT
is unavailable because statistics is turned off. – Acidulent