标签:class from 语句 order session || bms add _id
with vw_lock AS (SELECT * FROM v$lock)
select
a.sid,
‘is blocking‘,
(select ‘sid:‘||s.sid||‘ object:‘||do.object_name||‘ rowid:‘||
dbms_rowid.rowid_create ( 1, ROW_WAIT_OBJ#, ROW_WAIT_FILE#, ROW_WAIT_BLOCK#, ROW_WAIT_ROW# )
||‘ sql_id:‘||s.sql_id
from v$session s, dba_objects do
where s.sid=b.sid
and s.ROW_WAIT_OBJ# = do.OBJECT_ID
) blockee,
b.sid,b.id1,b.id2
from vw_lock a, vw_lock b
where a.block = 1
and b.request > 0
and a.id1 = b.id1
and a.id2 = b.id2;
输出的字段为:
sid: 持有锁的session id
blockee:被阻塞的session信息。包括session id、object name、rowid及sql_id。可根据该sql_id找出对应的sql语句。
sid:被阻塞的session id。
id1、id2含义:
TYPE
|
ID1
|
ID2
|
TM
|
被修改表的标识(object_id)
|
0
|
TX
|
以十进制数值表示该事务所占用的回滚段号与该事务在该回滚段的事务表(Transaction table)中所占用的槽号(slot number,可理解为记录号)。其组成形式为: 0xRRRRSSSS ( RRRR = RBS number, SSSS = slot )。
|
以十进制数值表示环绕(wrap)次数,即该槽(slot)被重用的次
|
查询锁谁阻塞了谁
标签:class from 语句 order session || bms add _id
原文地址:https://www.cnblogs.com/liang545621/p/9410673.html