v$session
The following sql statement can be used to find the SID of the session issueing the statement:
select sid from v$session where audsid=sys_context('userenv','SESSIONID') ;The fields module and action of v$session can be set with dbms_application_info.set_module. (See v$session_longops for an example.
Join sid with v$sesstat if you want to get some statistical information for a particular sesssion.
Column Usage SID Session identifier SERIAL# Session serial # PADDR Parent session address USER# Oracle User ID USERNAME Oracle username COMMAND Current command in progress (see also sys.audit_actions STATUS ACTIVE, INACTIVE, KILLED SERVER Type of server connection (DEDICATED, SHARED, PSEUDO, NONE) OSUSER OS Username TERMINAL Terminal of connection TYPE Type of Session (BACKGROUND or USER) SQL_HASH_VALUE and SQL ADDRESS)
Name Null? Type ----------------------------------------- -------- ---------------------------- SADDR RAW(8) SID NUMBER SERIAL# NUMBER AUDSID NUMBER PADDR RAW(8) USER# NUMBER USERNAME VARCHAR2(30) COMMAND NUMBER OWNERID NUMBER TADDR VARCHAR2(16) LOCKWAIT VARCHAR2(16) STATUS VARCHAR2(8) SERVER VARCHAR2(9) SCHEMA# NUMBER SCHEMANAME VARCHAR2(30) OSUSER VARCHAR2(30) PROCESS VARCHAR2(12) MACHINE VARCHAR2(64) TERMINAL VARCHAR2(30) PROGRAM VARCHAR2(48) TYPE VARCHAR2(10) SQL_ADDRESS RAW(8) SQL_HASH_VALUE NUMBER PREV_SQL_ADDR RAW(8) PREV_HASH_VALUE NUMBER MODULE VARCHAR2(48) MODULE_HASH NUMBER ACTION VARCHAR2(32) ACTION_HASH NUMBER CLIENT_INFO VARCHAR2(64) FIXED_TABLE_SEQUENCE NUMBER ROW_WAIT_OBJ# NUMBER ROW_WAIT_FILE# NUMBER ROW_WAIT_BLOCK# NUMBER ROW_WAIT_ROW# NUMBER LOGON_TIME DATE LAST_CALL_ET NUMBER PDML_ENABLED VARCHAR2(3) FAILOVER_TYPE VARCHAR2(13) FAILOVER_METHOD VARCHAR2(10) FAILED_OVER VARCHAR2(3) RESOURCE_CONSUMER_GROUP VARCHAR2(32) PDML_STATUS VARCHAR2(8) PDDL_STATUS VARCHAR2(8) PQ_STATUS VARCHAR2(8) CURRENT_QUEUE_DURATION NUMBER CLIENT_IDENTIFIER VARCHAR2(64)