V$ACTIVE_SESSION_HISTORY

V$ACTIVE_SESSION_HISTORY displays sampled session activity in the database. It contains snapshots of active database sessions taken once a second. A database session is considered active if it was on the CPU or was waiting for an event that didn't belong to the Idle wait class. Refer to the V$EVENT_NAME view for more information on wait classes.

This view contains one row for each active session per sample and returns the latest session sample rows first. A majority of the columns describing the session in the active session history are present in the V$SESSION view.

Column

Datatype

Description

SAMPLE_ID

NUMBER

ID of the sample

SAMPLE_TIME

TIMESTAMP(3)

Time at which the sample was taken

SESSION_ID

NUMBER

Session identifier; maps to V$SESSION.SID

SESSION_SERIAL#

NUMBER

Session serial number (used to uniquely identify a session's objects); maps to V$SESSION.SERIAL#

SESSION_TYPE

VARCHAR2(10)

Session type:

         FOREGROUND

         BACKGROUND

FLAGS

NUMBER

Reserved for future use

USER_ID

NUMBER

Oracle user identifier; maps to V$SESSION.USER#

SQL_ID

VARCHAR2(13)

SQL identifier of the SQL statement that the session was executing at the time of sampling

SQL_CHILD_NUMBER

NUMBER

Child number of the SQL statement that the session was executing at the time of sampling

SQL_OPCODE

NUMBER

Indicates what phase of operation the SQL statement was in; maps to V$SESSION.COMMAND

See Also: "V$SESSION" for information on interpreting this column

FORCE_MATCHING_SIGNATURE

NUMBER

Signature used when the CURSOR_SHARING parameter is set to FORCE

TOP_LEVEL_SQL_ID

VARCHAR2(13)

SQL identifier of the top level SQL statement

TOP_LEVEL_SQL_OPCODE

NUMBER

Indicates what phase of operation the top level SQL statement was in

SQL_PLAN_HASH_VALUE

NUMBER

Numerical representation of the SQL plan for the cursor. This information might not be available for all session samples. V$SESSION does not contain this information.

SQL_PLAN_LINE_ID

NUMBER

SQL plan line ID

SQL_PLAN_OPERATION

VARCHAR2(30)

Plan operation name

SQL_PLAN_OPTIONS

VARCHAR2(30)

Plan operation options

SQL_EXEC_ID

NUMBER

SQL execution identifier

SQL_EXEC_START

DATE

Time when the execution of the SQL started

PLSQL_ENTRY_OBJECT_ID

NUMBER

Object ID of the top-most PL/SQL subprogram on the stack; NULL if there is no PL/SQL subprogram on the stack

PLSQL_ENTRY_SUBPROGRAM_ID

NUMBER

Subprogram ID of the top-most PL/SQL subprogram on the stack; NULL if there is no PL/SQL subprogram on the stack

PLSQL_OBJECT_ID

NUMBER

Object ID of the currently executing PL/SQL subprogram; NULL if executing SQL

PLSQL_SUBPROGRAM_ID

NUMBER

Subprogram ID of the currently executing PL/SQL object; NULL if executing SQL

QC_INSTANCE_ID

NUMBER

Query coordinator instance ID. This information is only available if the sampled session is a parallel query slave. For all other sessions, the value is 0.

QC_SESSION_ID

NUMBER

Query coordinator session ID. This information is only available if the sampled session is a parallel query slave. For all other sessions, the value is 0.

QC_SESSION_SERIAL#

NUMBER

Query coordinator session serial number. This information is only available if the sampled session is a parallel query slave. For all other sessions, the value is 0.

EVENT

VARCHAR2(64)

If SESSION_STATE = WAITING, then the event for which the session was waiting for at the time of sampling.

If SESSION_STATE = ON CPU, then this column is NULL.

See Also: Appendix C, "Oracle Wait Events"

EVENT_ID

NUMBER

Identifier of the resource or event for which the session is waiting or for which the session last waited. Interpretation is similar to that of the EVENT column.

EVENT#

NUMBER

Number of the resource or event for which the session is waiting or for which the session last waited. Interpretation is similar to that of the EVENT column.

SEQ#

NUMBER

Sequence number that uniquely identifies the wait (incremented for each wait)

P1TEXT

VARCHAR2(64)

Text of the first additional parameter

P1

NUMBER

First additional parameter

P2TEXT

VARCHAR2(64)

Text of the second additional parameter

P2

NUMBER

Second additional parameter

P3TEXT

VARCHAR2(64)

Text of the third additional parameter

P3

NUMBER

Third additional parameter

WAIT_CLASS

VARCHAR2(64)

Wait class name of the event for which the session was waiting at the time of sampling. Interpretation is similar to that of the EVENT column. Maps to V$SESSION.WAIT_CLASS.

WAIT_CLASS_ID

NUMBER

Wait class identifier of the event for which the session was waiting at the time of sampling. Interpretation is similar to that of the EVENT column. Maps to V$SESSION.WAIT_CLASS_ID.

WAIT_TIME

NUMBER

Total wait time for the event for which the session last waited if the session was on the CPU when sampled; 0 if the session was waiting at the time of sampling

Note: Whether or not WAIT_TIME = 0 is what is useful to find the SESSION_STATE at the time of sampling, rather than the actual value of WAIT_TIME itself. Maps to V$SESSION.WAIT_TIME.

SESSION_STATE

VARCHAR2(7)

Session state:

         WAITING

         ON CPU

TIME_WAITED

NUMBER

If SESSION_STATE = WAITING, then the time that the session actually spent waiting for that EVENT. This column is set for waits that were in progress at the time the sample was taken.

If a wait event lasted for more than a second and was caught waiting in more than one session sample row, then the actual time spent waiting for that wait event will be populated in the last of those session sample rows. At any given time, this information will not be available for the latest session sample.

BLOCKING_SESSION_STATUS

VARCHAR2(11)

Status of the blocking session:

         VALID

         NO HOLDER

         GLOBAL

         NOT IN WAIT

         UNKNOWN

BLOCKING_SESSION

NUMBER

Session identifier of the blocking session. Populated only if the blocker is on the same instance and the session was waiting for enqueues or a "buffer busy" wait. Maps to V$SESSION.BLOCKING_SESSION.

BLOCKING_SESSION_SERIAL#

NUMBER

Serial number of the blocking session

CURRENT_OBJ#

NUMBER

Object ID of the object that the session is referencing. This information is only available if the session was waiting for application, cluster, concurrency, and user I/O wait events. Maps to V$SESSION.ROW_WAIT_OBJ#.

CURRENT_FILE#

NUMBER

File number of the file containing the block that the session is referencing. This information is only available if the session was waiting for cluster, concurrency, and user I/O wait events. Maps to V$SESSION.ROW_WAIT_FILE#.

CURRENT_BLOCK#

NUMBER

ID of the block that the session is referencing. This information is only available if the session was waiting for cluster, concurrency, and user I/O wait events. Maps to V$SESSION.ROW_WAIT_BLOCK#.

CURRENT_ROW#

NUMBER

Row identifier that the session is referencing. This information is only available if the session was waiting for cluster, concurrency, and user I/O wait events. Maps to V$SESSION.ROW_WAIT_ROW#.

CONSUMER_GROUP_ID

NUMBER

Consumer group ID

XID

RAW(8)

Transaction ID that the session was working on at the time of sampling. V$SESSION does not contain this information.

REMOTE_INSTANCE#

NUMBER

Remote instance identifier that will serve the block that this session is waiting for. This information is only available if the session was waiting for cluster events.

IN_CONNECTION_MGMT

VARCHAR2(1)

Indicates whether the session was doing connection management at the time of sampling (Y) or not (N)

IN_PARSE

VARCHAR2(1)

Indicates whether the session was parsing at the time of sampling (Y) or not (N)

IN_HARD_PARSE

VARCHAR2(1)

Indicates whether the session was hard parsing at the time of sampling (Y) or not (N)

IN_SQL_EXECUTION

VARCHAR2(1)

Indicates whether the session was executing SQL statements at the time of sampling (Y) or not (N)

IN_PLSQL_EXECUTION

VARCHAR2(1)

Indicates whether the session was executing PL/SQL at the time of sampling (Y) or not (N)

IN_PLSQL_RPC

VARCHAR2(1)

Indicates whether the session was executing inbound PL/SQL RPC calls at the time of sampling (Y) or not (N)

IN_PLSQL_COMPILATION

VARCHAR2(1)

Indicates whether the session was compiling PL/SQL at the time of sampling (Y) or not (N)

IN_JAVA_EXECUTION

VARCHAR2(1)

Indicates whether the session was executing Java at the time of sampling (Y) or not (N)

IN_BIND

VARCHAR2(1)

Indicates whether the session was doing bind operations at the time of sampling (Y) or not (N)

IN_CURSOR_CLOSE

VARCHAR2(1)

Indicates whether the session was closing a cursor at the time of sampling (Y) or not (N)

SERVICE_HASH

NUMBER

Hash that identifies the Service; maps to V$ACTIVE_SERVICES.NAME_HASH

PROGRAM

VARCHAR2(64)

Name of the operating system program

MODULE

VARCHAR2(48)

Name of the executing module when sampled, as set by the DBMS_APPLICATION_INFO.SET_MODULE procedure

ACTION

VARCHAR2(32)

Name of the executing module when sampled, as set by the DBMS_APPLICATION_INFO.SET_ACTION procedure

CLIENT_ID

VARCHAR2(64)

Client identifier of the session; maps to V$SESSION.CLIENT_IDENTIFIER