In Oracle, it provides a view V$SESSION to display all current session details. There are other several queries you can use to see your own session ID.
Find below queries to get your own session ID:
select sys_context('USERENV','SID') SESSION_ID from dual;
select distinct sid from v$mystat;
select to_number(substr(dbms_session.unique_session_id,1,4),'XXXX') mysid from dual;
select sid from v$mystat where rownum <=1;
Sample Outputs:
SQL> select sys_context('USERENV','SID') SESSION_ID from dual;
SESSION_ID
--------------------------------------------------------------------------------
283
SQL>
SQL> select sid from v$mystat where rownum <=1;
SID
----------
283
SQL> select to_number(substr(dbms_session.unique_session_id,1,4),'XXXX') mysid from dual;
MYSID
----------
283
SQL> select distinct sid from v$mystat;
SID
----------
283
SQL>
Thanks,
Chowdari
Find below queries to get your own session ID:
select sys_context('USERENV','SID') SESSION_ID from dual;
select distinct sid from v$mystat;
select to_number(substr(dbms_session.unique_session_id,1,4),'XXXX') mysid from dual;
select sid from v$mystat where rownum <=1;
Sample Outputs:
SQL> select sys_context('USERENV','SID') SESSION_ID from dual;
SESSION_ID
--------------------------------------------------------------------------------
283
SQL>
SQL> select sid from v$mystat where rownum <=1;
SID
----------
283
SQL> select to_number(substr(dbms_session.unique_session_id,1,4),'XXXX') mysid from dual;
MYSID
----------
283
SQL> select distinct sid from v$mystat;
SID
----------
283
SQL>
Thanks,
Chowdari
No comments:
Post a Comment