暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

How do I find my SID (session id) from SQL*Plus

2011-01-01
933

The Oracle (tm) Users' Co-Operative FAQ

How do I find my SID (session id) from SQL*Plus/PLSQL.


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:



最后修改时间:2020-04-16 15:13:11
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论