How to Find Out Your Current / Own Oracle Session ID - SID?

advertisements

_____________________________________________________________________________________________________________________

The Eucharistic Miracles of the World
For RAC Database with Instance ID
SQL> select username,inst_id, sid, serial# FROM gV$SESSION WHERE audsid = userenv('sessionid');

USERNAME                          INST_ID        SID    SERIAL#
------------------------------ ---------- ---------- ----------
APPINSTALL                              2          2        149
APPINSTALL                              2       1237       7079
APPINSTALL                              3        718       7085

For Single Instance Database
  1. Using V$session and USERENV
SQL> select sid OwnSID FROM V$SESSION WHERE audsid = userenv('sessionid');

    OWNSID
----------
         2
  1. Using SYS_CONTEXT
SQL>  select sys_context ( 'USERENV' , 'SID' ) OwnSID from dual;

OWNSID
----------
2
  1. Using V$mystat
SQL> select distinct sid OwnSID from v$mystat;

 OWNSID
-------
      2

_____________________________________________________________________________________________________________________

Website Stats

0 comments:

Post a Comment

Labels

Oracle (629) Script (86) General (77) Unix (47) Blog (23) Technology (19) gadget (6) games (6) Business (3) OCI (3) SQL* Loader (3) Datapump (2)
 

acehints.com Copyright 2011-23 All Rights Reserved | Site Map | Contact | Disclaimer