如果LB指向ITL对应的事务状态不是active,则将Lock Structure挂到Resource Structure的Owner链表,然后在回滚段中获得一个事务槽、分配空间,创建数据的前镜像,然后到块头申请ITL表项,并修改block的itl Lck标志位,修改记录lb标志位指向事务所在的itl。事务结束时,将会去检查Waiter和Conversion 链表,Conversion链表优先,将锁分配给最先进入队列的请求者。
[size=11.6667px]下面修改表中的数据,不提交,然后DUMP数据块,查看DUMP中的ITL和行的LB
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
/*设置跟踪文件的标识符,方便查找*/
SQL> alter session set tracefile_identifier='dump';
Session altered.
/*查找行的文件号和块号*/
SQL> select dbms_rowid.rowid_relative_fno(rowid)file_id,dbms_rowid.rowid_block_number(rowid)block_id from department where depid='D2285';
FILE_ID BLOCK_ID
---------- ----------
7 1259[size=11.6667px]
SQL> update department set note='lock test' where depid='D2285';
1 row updated
SQL> alter system dump datafile 7 block 1259;
System altered./*下面是DUMP内容,省略部分内容*/
Block header dump: 0x01c004eb
Object id on Block? Y
seg/obj: 0x12333 csc: 0x00.f765d1 itc: 2 flg: E typ: 1 - DATA
brn: 0 bdba: 0x1c004e8 ver: 0x01 opc: 0
inc: 0 exflg: 0