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

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
DBA Tips Data Pump Reference

0 comments:

Post a Comment

 

dba topics. Copyright 2011-16 All Rights Reserved | Site Map | Contact | Disclaimer | Google