Check session id and serial# for session connected in Oracle

Check session id and serial# for session connected in Oracle

Get the SID of current session

--Get the SID of current session
SELECT SYS_CONTEXT ('USERENV', 'SID') FROM DUAL;

SYS_CONTEXT('USERENV','SID')
-----------------------------
11

--You can get from mystat view also
select sid from v$mystat where rownum <=1;

SID
----------
11

Get Serial# of current session

select 'SID = '||sid||' Serial# = '||serial# SID_SR_TXT from v$session
where sid in (select sid from v$mystat where rownum <=1);

SID_SR_TXT
---------------------------
SID = 11 Serial# = 39815

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.