Thursday, June 17, 2010

Oracle Session Id

Everytime you connect to oracle you start a new session.Each session is identified by a session_id. The sesssion_id can be very useful to the DBA to monitor your queries.

select sys_context('USERENV','SID') from dual;
or
select sid from v$mystat where rownum <=1;
or
select to_number(substr(dbms_session.unique_session_id,1,4),'XXXX') mysid from dual;
or
select distinct sid from v$mystat;

No comments:

Post a Comment