2.2 free list概念
free list是一种单向链表用于定位可以接收数据的块,在字典管理方式的表空间中,Oracle使用free list来管理未分配的存储块。Oracle记录了有空闲空间的块用于insert或Update。空闲空间来源于两种方式:1.段中所有超过HWM的块,这些块已经分配给段了,但是还未被使用。2.段中所有在HWM下的且链入了free list的块,可以被重用。free list具有下列属性
l flag指示free list 被使用(1)或未使用(0)
l free list 链的首块的地址DBA(data block address)
l free list 链的尾块的地址DBA
free list 的信息通常保留在segment header中,这里给出segment header block dump片段加以说明:
nfl = 3, nfb = 1 typ = 1 nxf = 0 SEG LST:: flg: UNUSED lhd: 0x00000000 ltl: 0x00000000 SEG LST:: flg: USED lhd: 0x03c00233 ltl: 0x03c00233 SEG LST:: flg: USED lhd: 0x03c00234 ltl: 0x03c00234 SEG LST:: flg: UNUSED lhd: 0x00000000 ltl: 0x00000000 Segment Header: ==> nfl: number of free lists/block ==> nfb: number of free list blocks + segment header ==> typ: block type ==> nxf: number of transaction free lists Segment List: ==> flg: flag USED or UNUSED the free list ==> lhd: head of free list ==> ltl: tail of free list |
在每一个块中都有一个标记flg用来表明块是否链入了 free list链中。如果这个标志置上,该块中后向指针指向free list链中下一个块的DBA。如果当前块是链的最末尾的块,该后向指针值为0。这里给出位于free list上的block dump的片段
Block header dump: 0x03c00235 Object id on Block? Y seg/obj: 0xe2d8 csc: 0x00.6264c61 itc: 1 flg: O typ: 1 - DATA fsl: 1 fnx: 0x3c00234 ver: 0x01 ==> Seg/obj Object ID in dictionary ==> csc SCN of last block cleanout ==> itc Number of ITL slots ==> flg O = On freelist , - = Not on freelist ==> typ 1 = DATA 2 = INDEX ==> fsl ITL TX freelist slot ==> fnx DBA of NEXT block on freelist |
举例来说如果有五个块在free list中,分别为A,B,C,D,E
就会形成segment header->A->B->C->D->E--|
同时segment header->E