Monday, July 21, 2008

Who I am in V$SESSION

In a database, all users use the same userid like 'sadat'. Then,

SELECT USER FROM DUAL;

USER
------------------------------
SADAT

And in V$SESSION,
SELECT USER,AUDSID FROM V$SESSION;

USER SUDSID
----------------
SADAT 1234
SADAT 2345
SADAT 4567
SADAT 7654

To get the information about me, we can get audsid from the following sql,

select userenv('SESSIONID') from dual;

USERENV('SESSIONID')
--------------------
1234

Now,

select user,audsid,serial#, osuser,terminal from v$SESSION where audsid = 1234;

No comments:

search engine

Custom Search