Source link

Question:  What is the easiest way to display my session ID number?  I'm not a DBA, I just want to know my own session?

Answer: While Oracle provides the v$session view to display all current session details, there are several queries that you can use to see your own session ID number.  It's abbreviated SID, and these SQL queries will show your current SID:

select 
   sys_context('USERENV','SID') 
from dual;

select 
   sid 
from 
   v$mystat 
where 
   rownum <=1;

select 
   to_number(substr(dbms_session.unique_session_id,1,4),'XXXX') mysid 
from dual;

select distinct 
   sid 
from v$mystat;

posted on 2015-07-09 18:34  查祝兆  阅读(207)  评论(0编辑  收藏  举报