茴字的三種寫法-找出當前會話ID

wmlm發表於2010-05-01

Finding the current session's ID

select sid, serial# from v$session where audsid = sys_context('userenv','sessionid');

Or, if you're only interested in the sid, not in serial#:
select distinct sid from v$mystat;

Note, the selected sid has nothing to do with the System Identifier. If dbms_support is installed, the current sid can also be found with its mysid function:

select dbms_support.mysid from dual;

Thanks to Jan Arnoldus who pointed out an error on this page!

dbms_support的包位於 ?/rdbms/admin/dbmssupp.sql 檔案中

引自

[@more@]完

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/271063/viewspace-1033334/,如需轉載,請註明出處,否則將追究法律責任。

相關文章