描述:insert產(chǎn)生阻塞。
1,建立測試表。
SQL> create table lock1 (id1 int primary key);
Table created.
2,打開2個會話順序執(zhí)行插入操作,不提交.
會話15:
SQL> select sid from v$mystat where rownum<2;
SID
----------
15
SQL> insert into lock1 values (1);
1 row created.
會話151:
SQL> select sid from v$mystat where rownum<2;
SID
----------
151
SQL> insert into lock1 values (1); 《====會話151 插入數(shù)據(jù)庫,產(chǎn)生阻塞事件。
3,查看等待
SQL> select sid,event,BLOCKING_SESSION from v$session where BLOCKING_SESSION is not null;
SID EVENT BLOCKING_SESSION
---------- ---------------------------------------------------------------- ----------------
151
enq: TX - row lock contention 15 《================151 被15 給阻塞了。產(chǎn)生enq: TX - row lock contention 等待事件。
SQL> select * from v$Lock where sid in (15,151,21) and type='TX' order by sid;
ADDR KADDR SID TY ID1 ID2 LMODE REQUEST CTIME BLOCK
-------- -------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
55C69924 55C69964 15 TX 393230 952 6 0 165 1《===========waiting on a ROW。
55C7B03C 55C7B07C 151 TX 524320 892 6 0 104 0
576F9504 576F9530 151 TX 393230 952 0 4 104 0《=============== waiting some other resource held。
by the TX
0 - none
1 - null (NULL)
2 - row-S (SS)
3 - row-X (SX)
4 - share (S)
5 - S/Row-X (SSX)
6 - exclusive (X)
=================
分享題目:insert產(chǎn)生阻塞
路徑分享:
http://weahome.cn/article/gchggg.html