高水位是记录段里能容纳数据的上限,高水位存在段里
全表扫先读段头块,而后在段头块里面找到HWM
下面用实验由内而外来理解Oracle的HWM
--t表有一条数据
hr@ORCL> select * from t;
ID NAME
---------- ----------
1 AAAAA
--找t段的段头块
hr@ORCL> select header_file,header_block from dba_segments where segment_name='T' and owner='HR';
HEADER_FILE HEADER_BLOCK
----------- ------------
4 387
--另开一个session,dump段头块
sys@ORCL> alter session set tracefile_identifier='sys_dump_t_01';
Session altered.
sys@ORCL> alter system dump datafile 4 block 387;
System altered.
dump的部分trc内容摘入
Extent Control Header
-----------------------------------------------------------------
Extent Header:: spare1: 0 spare2: 0 #extents: 1 #blocks: 8
last map 0x00000000 #maps: 0 offset: 2716
Highwater:: 0x01000189 ext#: 0 blk#: 8 ext size: 8 --Highwater就是高水位,0x01000189这个是HWM的地址
#blocks in seg. hdr's freelists: 0
#blocks below: 5
mapblk 0x00000000 offset: 0
Unlocked
--------------------------------------------------------
Low HighWater Mark :
Highwater:: 0x01000189 ext#: 0 blk#: 8 ext size: 8
#blocks in seg. hdr's freelists: 0
#blocks below: 5
mapblk 0x00000000 offset: 0
Level 1 BMB for High HWM block: 0x01000181
Level 1 BMB for Low HWM block: 0x01000181
--------------------------------------------------------
Segment Type: 1 nl2: 1 blksz: 8192 fbsz: 0
L2 Array start offset: 0x00001434
First Level 3 BMB: 0x00000000
L2 Hint for inserts: 0x01000182
Last Level 1 BMB: 0x01000181
Last Level II BMB: 0x01000182
Last Level III BMB: 0x00000000
Map Header:: next 0x00000000 #extents: 1 obj#: 52713 flag: 0x10000000
Inc # 0
Extent Map
-----------------------------------------------------------------
0x01000181 length: 8
Auxillary Map
--------------------------------------------------------
Extent 0 : L1 dba: 0x01000181 Data dba: 0x01000184
--------------------------------------------------------
Second Level Bitmap block DBAs
--------------------------------------------------------
DBA 1: 0x01000182
d dump data blocks tsn: 4 file#: 4 minblk 387 maxblk 387