在oracle 的block中,列的数量是用一个字节来表示的中,因此,一个字节所记录的最大列数为255,当超过255列时,一行记录将分成2个row piece,这就是块内行链接,参照杨版主的帖子,做了一遍Intra-Block Chaining的试验,如下:
declare
v_sql varchar2(32767);
begin
v_sql:='CREATE TABLE T_256 (';
for i in 1 .. 256 loop
v_sql := v_sql || 'C' || i || ' NUMBER,';
end loop;
v_sql:=RTRIM(V_SQL,',') || ')';
EXECUTE IMMEDIATE V_SQL;
END;
/
SQL> declare
2 v_sql varchar2(32767);
3 begin
4 v_sql:='CREATE TABLE T_256 (';
5 for i in 1 .. 256 loop
6 v_sql := v_sql || 'C' || i || ' NUMBER,';
7 end loop;
8 v_sql:=RTRIM(V_SQL,',') || ')';
9 EXECUTE IMMEDIATE V_SQL;
10 END;
11 /
PL/SQL procedure successfully completed.
SQL> select count(*) from user_tab_columns where table_name='T_256';
COUNT(*)
----------
256
SQL> begin
2 execute immediate 'insert into t_256 values('
3 ||lpad('1,',510,'1,')||'1)';
4 commit;
5 end;
6 /
PL/SQL procedure successfully completed.
SQL> select dbms_rowid.rowid_relative_fno(rowid),
2 dbms_rowid.rowid_block_number(rowid)
3 from t_256;
DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID) DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)
------------------------------------ ------------------------------------
4 17342
SQL> alter system dump datafile 4 block 17342;
System altered.
data_block_dump,data header at 0xceb587c
===============
tsiz: 0x1f80
hsiz: 0x16
pbl: 0x0ceb587c
bdba: 0x010043be
76543210
flag=--------
ntab=1
nrow=2
frre=-1
fsbo=0x16
fseo=0x1c74
avsp=0x1c5e
tosp=0x1c5e
0xe:pti[0] nrow=2 ffs=0
0x12:pri[0] ffs=0x1c80
0x14:pri[1] ffs=0x1c74
block_row_dump:
tab 0, row 0, @0x1c80
tl: 768 fb: -----L-- lb: 0x1 cc: 255
col 0: [ 2] c1 02
col 1: [ 2] c1 02
...................
col 253: [ 2] c1 02
col 254: [ 2] c1 02
tab 0, row 1, @0x1c74
tl: 12 fb: --H-F--- lb: 0x1 cc: 1
nrid: 0x010043be.0
col 0: [ 2] c1 02
end_of_block_dump
End dump data blocks tsn: 4 file#: 4 minblk 17342 maxblk 17342
可以看出,在第一个row piece中只有一列,tl: 12 fb: --H-F--- lb: 0x1 cc: 1
,第二个row piece中保存了剩下的255列。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10972173/viewspace-613083/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10972173/viewspace-613083/