唯一索引引发的行锁

SQL> create table t2(id  int,name char(10));

Table created.

SQL> create unique index te_idx1 on t2(id);

Index created.

SQL> select * from v$mystat where rownum<2;

       SID STATISTIC#	   VALUE
---------- ---------- ----------
	35	    0	       0

SQL> insert into t2 values(1,'a');

1 row created.


SQL> select * from v$mystat where rownum<2;

       SID STATISTIC#	   VALUE
---------- ---------- ----------
	36	    0	       0

SQL>  insert into t2 values(1,'b');


hang---------
        SAMPLE_ID SESSION_ID
1	1670776	  36	25-2月 -01 12.25.42.878 下午	9jgxu7z5wr2dv	enq: TX - row lock contention	35	 insert into t2 values(1,'b')
2	1670775	  36	25-2月 -01 12.25.41.868 下午	9jgxu7z5wr2dv	enq: TX - row lock contention	35	 insert into t2 values(1,'b')
3	1670774	  36	25-2月 -01 12.25.40.868 下午	9jgxu7z5wr2dv	enq: TX - row lock contention	35	 insert into t2 values(1,'b')

原文地址:https://www.cnblogs.com/hzcya1995/p/13352391.html