| Author's name: Michael Bialik Author's Email: bialik@isdn.net.il |
Date written: 18 Aug 2001 Oracle version(s): 7.x, 8.0.x, 8.1.6, 8.1.7 |
| How do I find my SID (session id) from SQL*Plus/PLSQL. | |
There are 2 methods to determine my own SID (session id) either from SQL*Plus or PL/SQL. The first method may be used with Oracle 7.x and up, the second one only with Oracle 8i and up
Method 1 (for Oracle 7.x and up)
SELECT sid FROM V$SESSION
WHERE audsid = userenv('sessionid');
SID
---
9
Method 2 (for Oracle 8i and up - uses new function SYS_CONTEXT)
SELECT sid FROM V$SESSION
WHERE audsid = SYS_CONTEXT('userenv','sessionid');
SID
---
9.
Further reading: