V$Lock V$SQL V$session DBA Locks V$process V$sqlstats
V$Lock V$SQL V$session DBA Locks V$process V$sqlstats
V$Lock V$SQL V$session DBA Locks V$process V$sqlstats
This view lists the locks currently held by the Oracle Database and outstanding requests for a lock or latch. Column Datatype
ADDR KADDR SID TYPE RAW(4 | 8) RAW(4 | 8) NUMBER VARCHAR2(2)
Description Address of lock state object Address of lock Identifier for session holding or acquiring the lock Type of user or system lock The locks on the user types are obtained by user applications. Any process that is blocking others is likely to be holding one of these locks. The user type locks are:
TM TX UL
The locks on the system types are held for extremely short periods of time. The system type locks are listed in Table 4-1.
ID1 ID2 LMODE NUMBER NUMBER NUMBER
Lock identifier #1 (depends on type) Lock identifier #2 (depends on type) Lock mode in which the session holds the lock:
0 1 2 3 4 5 6
- none - null (NULL) - row-S (SS) - row-X (SX) - share (S) - S/Row-X (SSX) - exclusive (X)
REQUEST NUMBER
- none - null (NULL) - row-S (SS) - row-X (SX) - share (S) - S/Row-X (SSX) - exclusive (X)
CTIME BLOCK
NUMBER NUMBER
Time since current mode was granted The lock is blocking another lock
Table 4-1 Values for the TYPE Column: System Types System Type
BL CF CI CU DF DL DM DR DX FS HW IN IR IS IV JQ KK LA .. LP MM MR
Description Buffer hash table instance Control file schema global enqueue Cross-instance function invocation instance Cursor bind Data file instance Direct loader parallel index create Mount/startup db primary/secondary instance Distributed recovery process Distributed transaction entry File set Space management operations on a specific segment Instance number Instance recovery serialization global enqueue Instance state Library cache invalidation instance Job queue Thread kick
System Type
NA..NZ PF PI, PS PR QA..QZ RT SC SM SN SQ SS ST SV TA TS TS TT
Description Library cache pin instance (A..Z = namespace) Password File Parallel operation Process startup Row cache instance (A..Z = cache) Redo thread global enqueue System change number instance SMON Sequence number instance Sequence number enqueue Sort segment Space transaction enqueue Sequence number value Generic enqueue Temporary segment enqueue (ID2=0) New block allocation enqueue (ID2=1) Temporary table enqueue User name Undo segment DDL Being-written redo log instance
Library cache lock instance lock (A..P UN = namespace) Mount definition global enqueue Media recovery
US WL
http://docs.oracle.com/cd/B14117_01/server.101/b10755/dynviews_1123.htm
V$SQL
lists statistics on shared SQL area without the GROUP BY clause and contains one row for each child of the original SQL text entered. Statistics displayed in V$SQL are normally updated at the end of query execution. However, for long running queries, they are updated every 5 seconds. This makes it easy to see the impact of long running SQL statements while they are still in progress.
V$SQL
Column
SQL_TEXT
Datatype
VARCHAR2(1000)
Description First thousand characters of the SQL text for the current cursor Full text for the SQL statement exposed as a CLOB column. The full text of a SQL statement can be retrieved using this column instead of joining with the V$SQL_TEXT dynamic performance view. SQL identifier of the parent cursor in the library cache Amount of shared memory used by the child cursor (in bytes) Fixed amount of memory used for the lifetime of the child cursor (in bytes) Fixed amount of memory required during the execution of the child cursor Number of sorts that were done for the child cursor Indicates whether the context heap is loaded (1) or not (0) Indicates whether the child cursor is locked (1) or not (0) Number of users executing the statement Number of fetches associated with the SQL statement Number of executions that took place on this object since it was brought into the library cache Total number of executions performed by Parallel eXecution Servers. The value is 0 when the statement has never been executed in parallel. Number of times this cursor was fully executed since the cursor was brought into the library cache. The value of this statistic is not incremented when the cursor is partially executed, either because it failed during the execution or because only the first few rows produced by this cursor are fetched before the cursor is closed or reexecuted. By definition, the value of the END_OF_FETCH_COUNT column should be less or equal to the value of the EXECUTIONS column. Number of users executing the statement Number of times the object was either loaded or reloaded Timestamp of the parent creation time
SQL_FULLTEXT
CLOB
SQL_ID SHARABLE_MEM
VARCHAR2(13) NUMBER
PERSISTENT_MEM
NUMBER
RUNTIME_MEM
NUMBER
PX_SERVERS_EXECUTIONS
NUMBER
END_OF_FETCH_COUNT
NUMBER
Column
INVALIDATIONS PARSE_CALLS DISK_READS DIRECT_WRITES BUFFER_GETS APPLICATION_WAIT_TIME CONCURRENCY_WAIT_TIME CLUSTER_WAIT_TIME USER_IO_WAIT_TIME PLSQL_EXEC_TIME JAVA_EXEC_TIME ROWS_PROCESSED COMMAND_TYPE OPTIMIZER_MODE OPTIMIZER_COST OPTIMIZER_ENV
Datatype
NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER VARCHAR2(10) NUMBER RAW(691)
Description Number of times this child cursor has been invalidated Number of parse calls for this child cursor Number of disk reads for this child cursor Number of direct writes for this child cursor Number of buffer gets for this child cursor Application wait time (in microseconds) Concurrency wait time (in microseconds) Cluster wait time (in microseconds) User I/O Wait Time (in microseconds) PL/SQL execution time (in microseconds) Java execution time (in microseconds) Total number of rows the parsed SQL statement returns Oracle command type definition Mode under which the SQL statement is executed Cost of this query given by the optimizer Optimizer environment Hash value for the optimizer environment User ID of the user who originally built this child cursor Schema ID that was used to originally build this child cursor Schema name that was used to originally build this child cursor Indicates whether this child cursor has been marked to be kept pinned in the cache using the DBMS_SHARED_POOL package Address of the handle to the parent for this cursor Descriptor of the type check heap for this child cursor Hash value of the parent statement in the library cache Old SQL hash value Numerical representation of the SQL plan for this cursor. Comparing onePLAN_HASH_VALUE to another easily identifies whether or not two plans are the same (rather than comparing the two plans line by line). Number of this child cursor Service name Hash value for the name listed in SERVICE Contains the name of the module that was executing at the time that the SQL statement was first parsed, which is
PARSING_SCHEMA_NAME
VARCHAR2(30)
KEPT_VERSIONS
NUMBER
Column
MODULE_HASH ACTION
Datatype
NUMBER VARCHAR2(64)
Description set by calling DBMS_APPLICATION_INFO.SET_MODULE Hash value of the module listed in the MODULE column Contains the name of the action that was executing at the time that the SQL statement was first parsed, which is set by calling DBMS_APPLICATION_INFO.SET_ACTION Hash value of the action listed in the ACTION column Number of times the transaction fails to serialize, producing ORA-08177 errors, per cursor If an outline was applied during construction of the cursor, then this column displays the category of that outline. Otherwise the column is left blank. CPU time (in microseconds) used by this cursor for parsing, executing, and fetching Elapsed time (in microseconds) used by this cursor for parsing, executing, and fetching Outline session identifier Address of the child cursor Denotes the version of the SQL language used for this statement Indicates whether the cursor is remote mapped (Y) or not (N) Status of the cursor: VALID - Valid, authorized without errors VALID_AUTH_ERROR - Valid, authorized with authorization errors VALID_COMPILE_ERROR - Valid, authorized with compilation errors VALID_UNAUTH - Valid, unauthorized INVALID_UNAUTH - Invalid, unauthorized INVALID - Invalid, unauthorized but keep the timestamp Hash value of the literals which are replaced with systemgenerated bind variables and are to be matched, when CURSOR_SHARING is used. This is not the hash value for the SQL statement. If CURSOR_SHARING is not used, then the value is 0. Time at which the query plan (heap 6) was loaded into the library cache Indicates whether the cursor has become obsolete (Y) or not (N). This can happen if the number of child cursors is too large. Child latch number that is protecting the cursor SQL profile
ACTION_HASH SERIALIZABLE_ABORTS
NUMBER NUMBER
OUTLINE_CATEGORY
VARCHAR2(64)
CPU_TIME
NUMBER
ELAPSED_TIME
NUMBER
REMOTE
VARCHAR2(1)
OBJECT_STATUS
VARCHAR2(19)
LITERAL_HASH_VALUE
NUMBER
LAST_LOAD_TIME
VARCHAR2(19)
IS_OBSOLETE
VARCHAR2(1)
CHILD_LATCH SQL_PROFILE
NUMBER VARCHAR2(64)
Column
PROGRAM_ID PROGRAM_LINE#
Datatype
NUMBER NUMBER
Description Program identifier Program line number Signature calculated on the normalized SQL text. The normalization includes the removal of white space and the uppercasing of all non-literal strings. The signature used when the CURSOR_SHARING parameter is set to FORCE TIme at which the query plan was last active Bind data
EXACT_MATCHING_SIGNATURE NUMBER
FORCE_MATCHING_SIGNATURE NUMBER
LAST_ACTIVE_TIME BIND_DATA
DATE RAW(2000)
DBA_LOCK
DBA_LOCK
lists all locks or latches held in the database, and all outstanding requests for a lock
or latch.
Column
SESSION_ID LOCK_TYPE
Datatype
NUMBER VARCHAR2(26)
See Also: For a listing of lock types, see Appendix D, "Oracle Enqueue Names"
MODE HELD MODE REQUESTED LOCK_ID1 LOCK_ID2 LAST_CONVERT VARCHAR2(40) VARCHAR2(40) VARCHAR2(40) VARCHAR2(40) NUMBER
Lock mode Lock mode requested Type-specific lock identifier, part 1 Type-specific lock identifier, part 2 The last convert Whether the lock is currently blocking others
BLOCKING_OTHERS VARCHAR2(40)
V$PROCESS
This view contains information about the currently active processes. While the LATCHWAIT column indicates what latch a process is waiting for, the LATCHSPINcolumn indicates what latch a process is spinning on. On multi-processor machines, Oracle processes will spin on a latch before waiting on it. Column
ADDR PID SPID USERNAME
Datatype
RAW(4 | 8) NUMBER VARCHAR2(12) VARCHAR2(15)
Description Address of process state object Oracle process identifier Operating system process identifier Operating system process username. Any two-task user coming across the network has "-T" appended to the username. Process serial number Operating system terminal identifier Program in progress Trace file identifier
1
Address of latch the process is waiting for; NULL if none Address of the latch the process is spinning on; NULL if none PGA memory currently used by the process PGA memory currently allocated by the process (including free PGA memory not yet released to the operating system by the server process) Allocated PGA memory which can be freed Maximum PGA memory ever allocated by the process
V$SESSION
This view lists session information for each current session. Column
SADDR SID SERIAL#
Datatype
RAW(4 | 8) NUMBER NUMBER
Description Session address Session identifier Session serial number. Used to uniquely identify a session's objects. Guarantees that session-level commands are applied to the correct session objects if the session ends and another session begins with the same session ID. Auditing session ID Address of the process that owns the session Oracle user identifier Oracle username Command in progress (last statement parsed); for a list of values, see Table 7-5. These values also appear in the AUDIT_ACTIONS table. The column contents are invalid if the value is 2147483644. Otherwise, this column contains the identifier of the user who owns the migratable session. For operations using Parallel Slaves, interpret this value as a 4-byte value. The low-order 2 bytes of which represent the session number, and the high-order bytes the instance ID of the query coordinator. Address of transaction state object Address of lock waiting for; null if none Status of the session: ACTIVE - Session currently executing SQL
INACTIVE
OWNERID
NUMBER
- Session marked to be killed - Session temporarily cached for use by Oracle*XA SNIPED - Session inactive, waiting on the client
KILLED CACHED
Server type (DEDICATED| SHARED| PSEUDO| NONE) Schema user identifier Schema user name Operating system client user name Operating system client process ID Operating system machine name Operating system terminal name Operating system program name
Column
TYPE SQL_ADDRESS
Datatype
VARCHAR2(10) RAW(4 | 8)
Description Session type Used with SQL_HASH_VALUE to identify the SQL statement that is currently being executed Used with SQL_ADDRESS to identify the SQL statement that is currently being executed SQL identifier of the SQL statement that is currently being executed Child number of the SQL statement that is currently being executed Used with PREV_HASH_VALUE to identify the last SQL statement executed Used with SQL_HASH_VALUE to identify the last SQL statement executed SQL identifier of the last SQL statement executed Child number of the last SQL statement executed Name of the currently executing module as set by calling theDBMS_APPLICATION_INFO.SET_MODULE procedure Hash value of the above MODULE Name of the currently executing action as set by calling theDBMS_APPLICATION_INFO.SET_ACTION procedure Hash value of the above action name Information set by the DBMS_APPLICATION_INFO.SET_CLIENT_INFO procedure This contains a number that increases every time the session completes a call to the database and there has been an intervening select from a dynamic performance table. This column can be used by performance monitors to monitor statistics in the database. Each time the performance monitor looks at the database, it only needs to look at sessions that are currently active or have a higher value in this column than the highest value that the performance monitor saw the last time. All the other sessions have been idle since the last time the performance monitor looked at the database. Object ID for the table containing the row specified in ROW_WAIT_ROW# Identifier for the datafile containing the row specified in ROW_WAIT_ROW#. This column is valid only if the session is currently waiting for another transaction to commit and the value of ROW_WAIT_OBJ# is not -1. Identifier for the block containing the row specified in ROW_WAIT_ROW#. This column is valid only if the session is currently waiting for another transaction to commit and the value ofROW_WAIT_OBJ# is not -1.
SQL_HASH_VALUE
NUMBER
SQL_ID
VARCHAR2(13)
SQL_CHILD_NUMBER
NUMBER
PREV_SQL_ADDR
RAW(4 | 8)
PREV_HASH_VALUE
NUMBER
MODULE_HASH ACTION
NUMBER VARCHAR2(32)
ACTION_HASH CLIENT_INFO
NUMBER VARCHAR2(64)
FIXED_TABLE_SEQUENCE
NUMBER
ROW_WAIT_OBJ#
NUMBER
ROW_WAIT_FILE#
NUMBER
ROW_WAIT_BLOCK#
NUMBER
Column
ROW_WAIT_ROW#
Datatype
NUMBER
Description Current row being locked. This column is valid only if the session is currently waiting for another transaction to commit and the value of ROW_WAIT_OBJ# is not -1. Time of logon If the session STATUS is currently ACTIVE, then the value represents the elapsed time in seconds since the session has become active. If the session STATUS is currently INACTIVE, then the value represents the elapsed time in seconds since the session has become inactive. This column has been replaced by column PDML_STATUS Indicates whether and to what extent transparent application failover (TAF) is enabled for the session: NONE - Failover is disabled for this session SESSION - Client is able to fail over its session following a disconnect SELECT - Client is able to fail over queries in progress as well See Also: Oracle Database Concepts for more information on TAF Oracle Database Net Services Administrator's Guide for information on configuring TAF Indicates the transparent application failover method for the session: NONE - Failover is disabled for this session BASIC - Client itself reconnects following a disconnect PRECONNECT - Backup instance can support all connections from every instance for which it is backed up Indicates whether the session is running in failover mode and failover has occurred (YES) or not (NO) Name of the session's current resource consumer group If ENABLED, the session is in a PARALLEL DML enabled mode. If DISABLED, PARALLEL DML enabled mode is not supported for the session. If FORCED, the session has been altered to force PARALLEL DML. If ENABLED, the session is in a PARALLEL DDL enabled mode. If DISABLED, PARALLEL DDL enabled mode is not supported for the session. If FORCED, the session has been altered to force PARALLEL DDL. If ENABLED, the session is in a PARALLEL QUERY enabled mode. If DISABLED, PARALLEL QUERY enabled mode is not supported for the session. If FORCED, the session has been altered to force PARALLEL QUERY.
LOGON_TIME LAST_CALL_ET
DATE NUMBER
PDML_ENABLED FAILOVER_TYPE
VARCHAR2(3) VARCHAR2(13)
FAILOVER_METHOD
VARCHAR2(10)
FAILED_OVER
VARCHAR2(3)
PDDL_STATUS
VARCHAR2(8)
PQ_STATUS
VARCHAR2(8)
Column
CURRENT_QUEUE_DURATION
Datatype
NUMBER
Description If queued (1), the current amount of time the session has been queued. If not currently queued, the value is 0. Client identifier of the session Blocking session status:
VALID NO HOLDER GLOBAL NOT IN WAIT UNKNOWN
CLIENT_IDENTIFIER
VARCHAR2(64)
BLOCKING_SESSION_STATUS VARCHAR2(11)
Instance identifier of blocking session Session identifier of blocking session Sequence number that uniquely identifies the wait. Incremented for each wait. Event number Resource or event for which the session is waiting See Also: Appendix C, "Oracle Wait Events" Description of the first additional parameter First additional parameter First additional parameter Description of the second additional parameter Second additional parameter Second additional parameter Description of the third additional parameter Third additional parameter Third additional parameter Identifier of the wait class Number of the wait class Name of the wait class A nonzero value is the session's last wait time. A zero value means the session is currently waiting. If WAIT_TIME = 0, then SECONDS_IN_WAIT is the seconds spent in the current wait condition. If WAIT_TIME > 0, then SECONDS_IN_WAIT is the seconds since the start of the last wait, and SECONDS_IN_WAIT - WAIT_TIME / 100 is the active seconds since the last wait ended. Wait state:
EVENT# EVENT
NUMBER VARCHAR2(64)
P1TEXT P1 P1RAW P2TEXT P2 P2RAW P3TEXT P3 P3RAW WAIT_CLASS_ID WAIT_CLASS# WAIT_CLASS WAIT_TIME
VARCHAR2(64) NUMBER RAW(4) VARCHAR2(64) NUMBER RAW(4) VARCHAR2(64) NUMBER RAW(4) NUMBER NUMBER VARCHAR2(64) NUMBER
SECONDS_IN_WAIT
NUMBER
STATE
VARCHAR2(19)
(the session is currently waiting) -2 - WAITED UNKNOWN TIME (duration of last wait is unknown) -1 - WAITED SHORT TIME (last wait <1/100th of a second)
0 - WAITING
Column
Datatype
Description
= duration of
last wait)
SERVICE_NAME SQL_TRACE VARCHAR2(64) VARCHAR2(8)
Service name of the session Indicates whether SQL tracing is enabled (ENABLED) or disabled (DISABLED) Indicates whether wait tracing is enabled (TRUE) or not (FALSE) Indicates whether bind tracing is enabled (TRUE) or not (FALSE)
SQL_TRACE_WAITS
VARCHAR2(5)
SQL_TRACE_BINDS
VARCHAR2(5)
V$SQLSTATS
returns basic performance statistics for SQL cursors, with each row representing the data for a unique combination of SQL text and optimizer plan (that is, unique combination of SQL_ID, and PLAN_HASH_VALUE). The column definitions for columns in V$SQLSTATS are identical to those in the V$SQL andV$SQLAREA views. However, the V$SQLSTATS view differs from V$SQL and V$SQLAREA in that it is faster, more scalable, and has a greater data retention (the statistics may still appear in this view, even after the cursor has been aged out of the shared pool). Note that V$SQLSTATS contains a subset of columns that appear in V$SQL and V$SQLAREA.
V$SQLSTATS
Column
SQL_TEXT
Datatype
VARCHAR2(1000)
Description First thousand characters of the SQL text for the current cursor Full text for the SQL statement exposed as a CLOB column. THe full text of a SQL statement can be retrieved using this column instead of joining with the V$SQL_TEXT dynamic performance view. SQL identifier of the parent cursor in the library cache The last time that statistics for a cursor with this text and plan were updated The address of the cursor that last updated statistics Numerical representation of the SQL plan for this cursor. Comparing onePLAN_HASH_VALUE to another easily identifies whether or not two plans are the same (rather than comparing the two plans line by line) Number of parse calls for all cursors with this SQL text and plan Number of disk reads for all cursors with this SQL text and plan Number of direct writes for all cursors with this SQL text and plan Number of buffer gets for all cursors with this SQL text and plan Total number of rows the parsed SQL statement returns Number of time the transaction fails to serialize, producing ORA-08177 errors, per cursor Number of fetches associated with the SQL statement Number of executions that took place on this object since it was brought into the library cache
SQL_FULLTEXT
CLOB
SQL_ID LAST_ACTIVE_TIME
VARCHAR2(13) DATE
PARSE_CALLS
NUMBER
DISK_READS
NUMBER
DIRECT_WRITES
NUMBER
BUFFER_GETS
NUMBER
ROWS_PROCESSED SERIALIZABLE_ABORTS
NUMBER NUMBER
FETCHES EXECUTIONS
NUMBER NUMBER
Column
END_OF_FETCH_COUNT
Datatype
NUMBER
Description Number of times this cursor was fully executed since the cursor was brought into the library cache. The value of this statistic is not incremented when the cursor is partially executed, either because it failed during the execution or because only the first few rows produced by this cursor are fetched before the cursor is closed or re-executed. By definition, the value of the END_OF_FETCH_COUNT column should be less or equal to the value of the EXECUTIONS column. Number of times the object was either loaded or reloaded number of cursors present in the cache with this SQL text and plan Number of times this child cursor has been invalidated Total number of executions performed by Parallel eXecution Servers. The value is 0 when the statement has never been executed in parallel. CPU time (in microseconds) used by this cursor for parsing, executing, and fetching Elapsed time (in microseconds) used by this cursor for parsing, executing, and fetching Application wait time (in microseconds) Concurrency wait time (in microseconds) Cluster wait time (in microseconds) User I/O wait time (in microseconds) PL/SQL execution time (in microseconds) Java execution time (in microseconds) Number of sorts that were done for the child cursor Total shared memory (in bytes) currently occupied by all cursors with this SQL text and plan Total shared memory (in bytes) occupied by all cursors with this SQL text and plan if they were to be fully loaded in the shared pool (that is, cursor size)
LOADS
NUMBER
VERSION_COUNT
NUMBER
INVALIDATIONS PX_SERVERS_EXECUTIONS
NUMBER NUMBER
CPU_TIME
NUMBER
ELAPSED_TIME
NUMBER
TOTAL_SHAREABLE_MEM
NUMBER