检查锁情况的三种方法
来源:互联网 发布:极光网络永恒纪元官网 编辑:程序博客网 时间:2024/06/08 09:55
1.The v$locked_object View
The columns of this view are:
•XIDUSN: Rollback segment number
•OBJECT_ID: ID of the object being modified
•SESSION_ID: ID of the session locking the object
•ORACLE_USERNAME
•LOCKED_MODE
Example
To find the table name that corresponds to a particular object ID in the v$locked_object view:
SQL> SELECT xidusn, object_id, session_id, locked_mode
2 FROM v$locked_object;
XIDUSN OBJECT_ID SESSION_ID LOCKED_MODE
--------- --------- ---------- -----------
3 2711 9 3
0 2711 7 3
3 2711 9 3
0 2711 7 3
SQL> SELECT object_name FROM dba_objects
2 WHERE object_id = 2711;
OBJECT_NAME
-------------
EMPLOYEES
-------------
EMPLOYEES
If the value of xidusn is 0, then the session with the corresponding session ID is requesting and waiting for the lock being held by the session, for which xidusn value is different from 0.
2.The utllockt.sql Script
You can also use the utllockt.sql script to display lock wait-for in a hierarchy. The script prints the sessions that are waiting for locks and the sessions that are blocking.
You must run the catblock.sql script (found in $ORACLE_HOME/rdbms/admin folder) as a sysdba user before using utllockt.sql. The catblock.sql script creates the dba_locksand dba_blockers views along with others that will be used by utllockt.sql.
For example, in the following output session 9 is waiting for session 8, sessions 7 and 10 are waiting for 9.
WAITING TYPE MODE MODE LOCK LOCK
SESSION REQUESTED HELD ID1 ID2
SESSION REQUESTED HELD ID1 ID2
------- ---- ------------- ------------- ----- -----
8 NONE None None 0 0
9 TX Share (S) Exclusive (X) 65547 16
8 NONE None None 0 0
9 TX Share (S) Exclusive (X) 65547 16
7 RW Exclusive (X) S/Row-X (SSX) 33554440 2
10 RW Exclusive (X) S/Row-X (SSX) 33554440 2
3.The v$lock View
Two of the columns in this view are type and id1. These columns have the values:
Lock typeID1
TXRollback segment number and slot number
TMObject ID of the table being modified
Any process that is blocking others is likely to be holding a lock obtained by a user application. The locks acquired by user applications are:
•Table locks (TM)
•Row-level locks (TX)
To find the table name that corresponds to a particular resource ID 1 of the v$lock view:
SQL> SELECT object_name
2 FROM dba_objects, v$lock
3 WHERE object_id=id1 AND type='TM';
- 检查锁情况的三种方法
- 检查SQLServer 锁情况
- cocos2dx添加文本的三种方法及适用情况
- 类中没有构造方法的三种情况
- Java中方法不能重载的三种情况
- 对象的notify方法的含义和对象锁释放的三种情况
- 对象的notify方法的含义和对象锁释放的三种情况
- 检查mysql的运行情况
- OutOfMemory的三种情况
- OutOfMemory的三种情况
- ucosii 任务的堆栈使用情况检查函数OSTaskStkChk()的应用方法
- Datatable中对某列求和,三种不同情况下的方法
- cocos2dx添加文本的三种方法及适用情况CCLabelTTF,CCLabelBMFont,CCLabelAtlas
- Datatable中对某列求和,三种不同情况下的方法
- cocos2dx添加文本的三种方法及适用情况CCLabelTTF,CCLabelBMFont,CCLabelAtlas
- cocos2dx添加文本的三种方法及适用情况CCLabelTTF,CCLabelBMFont,CCLabelAtlas
- cocos2dx添加文本的三种方法及适用情况CCLabelTTF,CCLabelBMFont,CCLabelAtlas
- cocos2dx添加文本的三种方法及适用情况CCLabelTTF,CCLabelBMFont,CCLabelAtlas
- 3香港公司3G提供业务
- 由今天开始,我也要使用Blog了!:)
- ajax简单示例(XML+XSLT+JavaScript+JAVA)(version1)
- 北京待售商品房数量信息将在网上全面公示
- AXD 与 时钟中断!!!
- 检查锁情况的三种方法
- 从ACM会议看中国大陆计算机科学与国外的差距-- 灵芯
- 在切分窗口中固定切分条的位置
- scarborough fair (song)
- 4510B BootLoader!!!!!!!!!
- 类间数据传递问题
- 文件隐藏后再也无法看到的解决方法.
- 《劝学》——荀子
- Lotus Domino/Notes与Exchange的比较