Oracle 视图 V$LOCKED_OBJECT 官方解释,作用,如何使用详细说明

本站中文解释

视图

V$LOCKED_OBJECT是一个视图,可以查询活动会话正在锁定的对象信息,如表、行、触发器、存储过程等等。它显示当前正在被锁定的对象,以及请求锁定这些对象的会话和服务名称。使用这个视图,可以查找出那些可能正在影响当前会话的对象正被谁给加锁。

使用方法:
SELECT session_id, oracle_username, blocker.os_user_name,
lock_type, mode_held, mode_requested
FROM v$locked_object, v$session blocker
WHERE v$locked_object.session_id = blocker.sid;

上述语句可以用于查询当前所有的被锁定的对象的会话ID、Oracle登录名、操作系统登录名、锁定类型、获得锁定和请求锁定模式。

官方英文解释

V$LOCKED_OBJECT lists all locks acquired by every transaction on the system. It shows which sessions are holding DML locks (that is, TM-type enqueues) on what objects and in what mode.

Column Datatype Description

XIDUSN

NUMBER

Undo segment number

XIDSLOT

NUMBER

Slot number

XIDSQN

NUMBER

Sequence number

OBJECT_ID

NUMBER

Object ID being locked

SESSION_ID

NUMBER

Session ID

ORACLE_USERNAME

VARCHAR2(128)

Oracle user name

OS_USER_NAME

VARCHAR2(128)

Operating system user name

PROCESS

VARCHAR2(24)

Operating system process ID

LOCKED_MODE

NUMBER

Lock mode. The numeric values for this column map to these text values for the lock modes for table locks:

  • 0 – NONE: lock requested but not yet obtained

  • 1 – NULL

  • 2 – ROWS_S (SS): Row Share Lock

  • 3 – ROW_X (SX): Row Exclusive Table Lock

  • 4 – SHARE (S): Share Table Lock

  • 5 – S/ROW-X (SSX): Share Row Exclusive Table Lock

  • 6 – Exclusive (X): Exclusive Table Lock

See Also: Oracle Database
Concepts
for more information about lock modes for table locks

CON_ID

NUMBER

The ID of the container to which the data pertains. Possible values include:

  • 0: This value is used for rows containing data that pertain to the entire CDB. This value is also used for rows in non-CDBs.

  • 1: This value is used for rows containing data that pertain to only the root

  • n: Where n is the applicable container ID for the rows containing data


数据运维技术 » Oracle 视图 V$LOCKED_OBJECT 官方解释,作用,如何使用详细说明