Find my current session id

There are multiple approaches:

SQL> SELECT sys_context('userenv','sessionid') Session_ID from dual;

SQL> SELECT sid FROM v$mystat WHERE rownum = 1;

SID
———-
145

SQL> SELECT sid FROM V$SESSION WHERE audsid = userenv('sessionid');

SID
———-
145

SQL> SELECT sid FROM V$SESSION WHERE audsid = SYS_CONTEXT('userenv','sessionid');

SID
———-
145

Leave a Reply

%d bloggers like this: