Insert produces blockage
Description: insert produces blocking.
1. Set up the test table.
SQL > create table lock1 (id1 int primary key)
Table created.
2. Open 2 sessions and perform insert operations sequentially without submitting.
Session 15:
SQL > select sid from v$mystat where rownum insert into lock1 values (1)
1 row created.
Session 151:
SQL > select sid from v$mystat where rownum insert into lock1 values (1); "= = session 151inserted into the database, resulting in a blocking event.
3, check the wait
SQL > select sid,event,BLOCKING_SESSION from v$session where BLOCKING_SESSION is not null
SID EVENT BLOCKING_SESSION
-
151151enq: TX-row lock contention 15 "= 151is blocked by 15. An enq: TX-row lock contention wait event is generated.
SQL > select * from v$Lock where sid in (151.151 pencils 21) and type='TX' order by sid
ADDR KADDR SID TY ID1 ID2 LMODE REQUEST CTIME BLOCK
-
55C69924 55C69964 15 TX 393230 952 60 0 165 1 "= waiting on a ROW.
55C7B03C 55C7B07C 151 TX 524320 892 6 0 104 0
576F9504 576F9530 151TX 393230 952 04 104 "= 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)
=