advertisements
_____________________________________________________________________________________________________________________
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 1237 7079
APPINSTALL 3 718 7085
For Single Instance Database
- Using V$session and USERENV
SQL> select sid OwnSID FROM V$SESSION WHERE audsid = userenv('sessionid');
OWNSID
----------
2
- Using SYS_CONTEXT
SQL> select sys_context ( 'USERENV' , 'SID' ) OwnSID from dual;
OWNSID
----------
2
- Using V$mystat
SQL> select distinct sid OwnSID from v$mystat;
OWNSID
-------
2
_____________________________________________________________________________________________________________________
0 comments:
Post a Comment