--對應每一個活動事務都包含一個條目
SELECT * FROM V$TRANSACTION;
--顯示已經登陸的會話
SELECT * FROM V$SESSION;
--對應持有全部enqueue隊列鎖以及正在等待鎖的會話,都分別包含一個條目
SELECT * FROM V$LOCK; session
select username,
v$lock.sid,
osuser,
trunc(id1/power(2,16)) rbs,
bitand(id1,to_number('ffff','xxxx'))+0 slot,
id2 seq,
lmode,
request
from v$lock, v$session
where v$lock.type = 'TX' and osuser = upper('lixiaobing001'); spa
select XIDUSN, XIDSLOT, XIDSQN
from v$transaction; 隊列
V$LOCK表更應算是一個隊列表而不是一個鎖表。許多人都認爲V$LOCK中會有4行,由於咱們鎖定了4行。不過,你要記住,Oracle不會在任何地方存儲行級鎖的列表(也就是說,不會爲每個被鎖定的行維護一個主列表)。要查看某一行是否被鎖定,必須直接找到這一行 事務
$LOCK表中的LMODE爲6,REQUEST爲0。若是在Oracle Server Reference手冊中查看V$LOCK表的定義,會發現LMODE=6是一個排他鎖。請求(REQUEST)值爲0則意味着你沒有發出請求;也就是說,你擁有這個鎖 it
RBS、SLOT和SEQ值與V$TRANSACTION信息匹配。這就是個人事務ID io
--誰阻塞了誰 test
select
(select username from v$session where sid=a.sid) blocker,
a.sid,
(select osuser from v$session where sid=a.sid) blocke_osr,
' is blocking ',
(select osuser from v$session where sid=b.sid) blockee_os,
(select username from v$session where sid=b.sid) blockee,
b.sid
from v$lock a, v$lock b
where a.block = 1
and b.request > 0
and a.id1 = b.id1
and a.id2 = b.id2; 登錄
select (select username
from v$session
where sid = v$lock.sid) username,
sid,
id1,
id2,
lmode,
request, block, v$lock.type
from v$lock
where sid = (select sid
from v$mystat
where rownum=1);
select object_name, object_id
from user_objects
where object_name in (upper('t_lxb_test_batch')); object