Identifying "my" session in V$SESSION

From: David Trahan <>
Date: Thu, 23 Dec 93 09:52:52 -0500
Message-ID: <>


        I'm working on a trigger that effectively "audits" transactions on a certain table. I'd like the trigger to have access to certain information about the "current" session (that is - the one that triggered the trigger) such as terminal name, hostname, etc. The stuff I'm looking for is mostly in V$SESSION, but I'm not sure how to figure out which row corresponds with the "current" session. I can't just use USERNAME because more than one session may be active with the same username.

I noticed that USERENV('SESSIONID') seems to correspond with the AUDSID column from V$SESSION:

  • Is this a "guaranteed" relationship - it certainly is not clearly documented as such?
  • The documentation implies that AUDSID is related to "auditing" - does it's content change depending upon whether or not I have auditing enabled?
  • Are there ANY circumstances under which AUDSID and USERENV('SESSIONID') will not match? (I did notice that if I CONNECT INTERNAL through SQLDBA, the AUDSID column is 0 - I can handle that, but I need to know if there are other similar circumstances.
  • Is there are better way to determine the relationship between "current" session and V$SESSION?
			Thanx in advance for any help you can offer!
					Dave Trahan
Received on Thu Dec 23 1993 - 15:52:52 CET

Original text of this message