ITPub博客

首页 > 数据库 > Oracle > 记录开始位置变化

记录开始位置变化

原创 Oracle 作者:psufnxk2000 时间:2013-12-25 15:57:57 0 删除 编辑
1 只要改变记录的长度,记录的开始位置就会发生改变:
2 对于char类型的(定长类型的) 已经提前分配好空间,所以记录开始位置不会发生改变。


varchar2类型,
create table aaa (id number,name varchar2(10)) tablespace "aaaaaaaa";
insert into aaa values (1,'a');
insert into aaa values (2,'b');
commit;
alter system checkpoint;
dump出的内容 :
block_row_dump:
tab 0, row 0, @0x1f90
tl: 8 fb: --H-FL-- lb: 0x1  cc: 2
col  0: [ 2]  c1 02
col  1: [ 1]  61
tab 0, row 1, @0x1f88
tl: 8 fb: --H-FL-- lb: 0x2  cc: 2
col  0: [ 2]  c1 03
col  1: [ 1]  62
end_of_block_dump
End dump data blocks tsn: 6 file#: 5 minblk 132 maxblk 132


update aaa set name='c' where id=1;      --改变值,未改变长度
commit;
alter system checkpoint;


block_row_dump:
tab 0, row 0, @0x1f90           --开始位置未变
tl: 8 fb: --H-FL-- lb: 0x1  cc: 2
col  0: [ 2]  c1 02
col  1: [ 1]  63
tab 0, row 1, @0x1f88
tl: 8 fb: --H-FL-- lb: 0x0  cc: 2
col  0: [ 2]  c1 03
col  1: [ 1]  62
end_of_block_dump
End dump data blocks tsn: 6 file#: 5 minblk 132 maxblk 132


update aaa set name='ccc' where id=1;          --改变长度
commit;
alter system checkpoint;




block_row_dump:
tab 0, row 0, @0x1f7e           --开始位置发生变化 
tl: 10 fb: --H-FL-- lb: 0x2  cc: 2
col  0: [ 2]  c1 02
col  1: [ 3]  63 63 63
tab 0, row 1, @0x1f88
tl: 8 fb: --H-FL-- lb: 0x0  cc: 2
col  0: [ 2]  c1 03
col  1: [ 1]  62
end_of_block_dump
End dump data blocks tsn: 6 file#: 5 minblk 132 maxblk 132


update aaa set name='ddd' where id=2;         --第二行改变长度
commit;
alter system checkpoint;


block_row_dump:
tab 0, row 0, @0x1f7e
tl: 10 fb: --H-FL-- lb: 0x2  cc: 2
col  0: [ 2]  c1 02
col  1: [ 3]  63 63 63
tab 0, row 1, @0x1f74       --位置也发生变化
tl: 10 fb: --H-FL-- lb: 0x1  cc: 2
col  0: [ 2]  c1 03
col  1: [ 3]  64 64 64
end_of_block_dump
End dump data blocks tsn: 6 file#: 5 minblk 132 maxblk 132


update aaa set name='e' where id=2;        --减少第二行的长度
commit;
alter system checkpoint;


block_row_dump:
tab 0, row 0, @0x1f7e
tl: 10 fb: --H-FL-- lb: 0x0  cc: 2
col  0: [ 2]  c1 02
col  1: [ 3]  63 63 63
tab 0, row 1, @0x1f6c       --减少时位置也发生变化 
tl: 8 fb: --H-FL-- lb: 0x2  cc: 2
col  0: [ 2]  c1 03
col  1: [ 1]  65
end_of_block_dump
End dump data blocks tsn: 6 file#: 5 minblk 132 maxblk 132


char类型的:
create table aaa_char (id number,name char(10)) tablespace "aaaaaaaa";


insert into aaa_char values (1,'a');
insert into aaa_char values (2,'b');
commit;
alter system checkpoint;


block_row_dump:
tab 0, row 0, @0x1f87
tl: 17 fb: --H-FL-- lb: 0x1  cc: 2
col  0: [ 2]  c1 02
col  1: [10]  61 20 20 20 20 20 20 20 20 20
tab 0, row 1, @0x1f76
tl: 17 fb: --H-FL-- lb: 0x1  cc: 2
col  0: [ 2]  c1 03
col  1: [10]  62 20 20 20 20 20 20 20 20 20
end_of_block_dump
End dump data blocks tsn: 6 file#: 5 minblk 140 maxblk 140


update aaa_char set name='c' where id=1;   --长度不变
commit;
alter system checkpoint;


block_row_dump:
tab 0, row 0, @0x1f87       --位置不变
tl: 17 fb: --H-FL-- lb: 0x1  cc: 2
col  0: [ 2]  c1 02
col  1: [10]  61 20 20 20 20 20 20 20 20 20
tab 0, row 1, @0x1f76
tl: 17 fb: --H-FL-- lb: 0x1  cc: 2
col  0: [ 2]  c1 03
col  1: [10]  62 20 20 20 20 20 20 20 20 20
end_of_block_dump
End dump data blocks tsn: 6 file#: 5 minblk 140 maxblk 140




update aaa set name='ccc' where id=1;      --长度改变
commit;
alter system checkpoint;


block_row_dump:
tab 0, row 0, @0x1f87       --位置还是不变
tl: 17 fb: --H-FL-- lb: 0x1  cc: 2
col  0: [ 2]  c1 02
col  1: [10]  61 20 20 20 20 20 20 20 20 20         --从这列的结构也可以看出来,空间是已经预分配好的,所以不会发生改变
tab 0, row 1, @0x1f76
tl: 17 fb: --H-FL-- lb: 0x1  cc: 2
col  0: [ 2]  c1 03
col  1: [10]  62 20 20 20 20 20 20 20 20 20
end_of_block_dump
End dump data blocks tsn: 6 file#: 5 minblk 140 maxblk 140

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/25099483/viewspace-1064337/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 醒目看锁
请登录后发表评论 登录
全部评论

注册时间:2011-05-31

  • 博文量
    215
  • 访问量
    700286