我们知道INITRANS和MAXTRANS 是控制一个data block上ITL(Intersted Transaction List)数量的参数,MAXTRANS
的最大值是255,那么每个block上真的能达到255个ITLs吗,每个ITL entry 占用24 bytes,它和DB_BLOCK_SIZE有没有关系呢.
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for Linux: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
创建2K,4K,8K,16K blocksize的tablespace
SQL> CREATE TABLESPACE ts2k DATAFILE '/data/oradata/mydb/ts2k01.dbf' SIZE 10M BLOCKSIZE 2K;
Tablespace created.
SQL> CREATE TABLESPACE ts4k DATAFILE '/data/oradata/mydb/ts4k.dbf' SIZE 10M BLOCKSIZE 4K;
Tablespace created.
SQL> CREATE TABLESPACE ts8k DATAFILE '/data/oradata/mydb/ts8k.dbf' SIZE 10M BLOCKSIZE 8K;
Tablespace created.
SQL> CREATE TABLESPACE ts16k DATAFILE '/data/oradata/mydb/ts16k.dbf' SIZE 10M BLOCKSIZE 16K;
Tablespace created.
创建一个initrans 255,blocksize 2k的table
SQL> create table test2k(num number) tablespace ts2k initrans 255;
Table created.
SQL> insert into test2k values(10);
1 row created.
SQL> select dbms_rowid.ROWID_RELATIVE_FNO(rowid),dbms_rowid.ROWID_BLOCK_NUMBER(rowid) from test2k;
DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID) DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)
------------------------------------ ------------------------------------
6 62
Dump这个block
SQL> alter system dump datafile 6 block 62;
System altered.
Block header dump: 0x0180003e
Object id on Block? Y
seg/obj: 0x2b1c csc: 0x00.93ce9 itc: 41 flg: E typ: 1 - DATA
brn: 0 bdba: 0x1800022 ver: 0x01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x0009.019.000000bf 0x00800540.00a8.05 --U- 1 fsc 0x0000.00093d91
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x03 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x04 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x05 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x06 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x07 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x08 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x09 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x0a 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x0b 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x0c 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x0d 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x0e 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x0f 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x10 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x11 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x12 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x13 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x14 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x15 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x16 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x17 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x18 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x19 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x1a 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x1b 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x1c 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x1d 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x1e 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x1f 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x20 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x21 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x22 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x23 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x24 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x25 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x26 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x27 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x28 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x29 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
我们发现实际只分配了41个ITLs,同样我们按照上面的范例做了4k,8k,16k的测试,结果如下
BLOCK SIZE ITLs allocated in block header
------------- ----------------------------
2048 41
4096 83
8192 169
16384 256