Saturday 4 August 2018

How to find SID(session ID) of connected session in sqlplus

This document describes how to find SID of connected session in SQLPLUS.

[oracle@server1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Sat Aug 4 19:37:58 2018

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>

SQL> select distinct(sid) "Your Session ID" from v$mystat;

Your Session ID
---------------
           6417

SQL> select sid from v$session where audsid = userenv('sessionid');

       SID
----------
44

SQL> select sid from v$mystat where rownum = 1;

       SID
----------
44

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

       SID
----------
44


Thanks for your patience view this post.................

No comments:

Post a Comment