Oracle 视图 V$TRANSACTION 官方解释,作用,如何使用详细说明
本站中文解释
**Oracle视图V$TRANSACTION**
V$TRANSACTION是Oracle数据库中的一个可重复使用的虚拟表,它可用于监控当前连接到数据库的所有会话和用户的事务情况。它可以帮助DBA监控当前正在运行的事务,以及某个时刻之后活动会话及事务的情况;并可以查看挂起会话及事务发生的时间以及相关原因。
**V$TRANSACTION的用途**
(1)识别会话和事务。V$TRANSACTION可以帮助识别连接到数据库的活动会话及事务,以及可能导致数据库性能问题的会话和事务的情况。
(2)分析会话和事务的状态。V$TRANSACTION可以帮助排查运行工作量或有关会话和事务的问题。
(3)解决活动会话及事务的问题。通过V$TRANSACTION可以帮助找出状态已锁定但会话还在活动状态的异常会话及事务,以及因调度导致性能问题的会话及事务。
**如何使用V$TRANSACTION**
(1)查看所有正在运行的会话及事务:
“`
SELECT SID,
SERIAL#,
USERNAME,
OSUSER,
TO_CHAR(LOGON_TIME, ‘DD/MM/YYYY HH24:MI:SS’),
PROGRAM,
LOCKWAIT
FROM V$SESSION
“`
(2)检查是否有“死锁”会话:
“`
SELECT SID,OPERATION,LOCKED_MODE
FROM V$LOCKED_OBJECT
WHERE SESSION_ID IN
(SELECT SID FROM V$SESSION WHERE LOCKWAIT!=’None’)
“`
(3)根据会话ID和序列号,检查该会话是否有活动事务:
“`
SELECT *
FROM V$TRANSACTION
WHERE SID=’&SID’
AND SERIAL#=’&SERIAL#’
“`
(4)查看某一会话是否有挂起的事务:
“`
SELECT SID,COMMAND,STATUS
FROM V$TRANSACTION
WHERE SID=’&SID’
AND COMMAND=’HOLD’
“`
另外,还可以通过V$TRANSACTION视图来检查某一指定时间段内的活动会话及事务的情况,以此查看对系统的影响情况。
官方英文解释
V$TRANSACTION
lists the active transactions in the system.
Column | Datatype | Description |
---|---|---|
|
| Address of the transaction state object |
|
| Undo segment number |
|
| Slot number |
|
| Sequence number |
|
| Undo block address (UBA) filenum |
|
| UBA block number |
|
| UBA sequence number |
|
| UBA record number |
|
| Status |
|
| Start time (wall clock) |
|
| Start system change number (SCN) base |
|
| Start SCN wrap |
|
| Start extent number |
|
| Start UBA file number |
|
| Start UBA block number |
|
| Start UBA sequence number |
|
| Start UBA record number |
|
| User session object address |
|
| Flag |
|
|
|
|
|
|
|
|
|
|
|
|
|
| Name of a named transaction |
|
| Previous transaction undo segment number |
|
| Previous transaction slot number |
|
| Previous transaction sequence number |
|
| Rollback segment number of the parent XID |
|
| Slot number of the parent XID |
|
| Sequence number of the parent XID |
|
| This column is obsolete and maintained for backward compatibility. The value of this column is always equal to the value in |
|
| This column is obsolete and maintained for backward compatibility. The value of this column is always equal to the value in |
|
| Number of undo blocks used |
|
| Number of undo records used |
|
| Logical I/O |
|
| Physical I/O |
|
| Consistent gets |
|
| Consistent changes |
|
| Start time (wall clock) |
|
| Dependent SCN base |
|
| Dependent SCN wrap |
|
| Start SCN |
|
| Dependent SCN |
|
| Transaction XID |
|
| Previous transaction XID |
|
| Parent transaction XID |
|
| The ID of the container to which the data pertains. Possible values include:
|