- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
2#
发表于 2012-5-23 20:23:26
ODM TEST:- Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
- With the Partitioning, OLAP, Data Mining and Real Application Testing options
- SQL>
- SQL> create table test_space(t1 varchar2(90));
- Table created.
- SQL> insert into test_space values ( rpad('Maclean',20,'Z'));
- 1 row created.
- SQL> insert into test_space values ( rpad('Maclean',20,'A'));
- 1 row created.
- SQL> insert into test_space values ( rpad('Maclean',20,'S'));
- 1 row created.
- SQL> commit;
- Commit complete.
- SQL> select dbms_rowid.rowid_block_number(rowid),dbms_rowid.rowid_relative_fno(rowid) from test_space;
- DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID) DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID)
- ------------------------------------ ------------------------------------
- 90306 1
- 90306 1
- 90306 1
- SQL> alter system checkpoint;
- System altered.
- SQL> alter system dump datafile 1 block 90306;
- System altered.
- SQL> oradebug setmypid
- Statement processed.
- SQL> oradebug tracefile_name
- /s01/admin/G10R25/udump/g10r25_ora_11763.trc
- SQL> select dump(t1,16),t1 from test_space;
- DUMP(T1,16)
- --------------------------------------------------------------------------------
- T1
- --------------------------------------------------
- Typ=1 Len=20: 4d,61,63,6c,65,61,6e,5a,5a,5a,5a,5a,5a,5a,5a,5a,5a,5a,5a,5a
- MacleanZZZZZZZZZZZZZ
- Typ=1 Len=20: 4d,61,63,6c,65,61,6e,41,41,41,41,41,41,41,41,41,41,41,41,41
- MacleanAAAAAAAAAAAAA
- Typ=1 Len=20: 4d,61,63,6c,65,61,6e,53,53,53,53,53,53,53,53,53,53,53,53,53
- MacleanSSSSSSSSSSSSS
- tab 0, row 0, @0x1f88
- tl: 24 fb: --H-FL-- lb: 0x1 cc: 1
- col 0: [20] 4d 61 63 6c 65 61 6e 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a
- tab 0, row 1, @0x1f70
- tl: 24 fb: --H-FL-- lb: 0x1 cc: 1
- col 0: [20] 4d 61 63 6c 65 61 6e 41 41 41 41 41 41 41 41 41 41 41 41 41
- tab 0, row 2, @0x1f58
- tl: 24 fb: --H-FL-- lb: 0x1 cc: 1
- col 0: [20] 4d 61 63 6c 65 61 6e 53 53 53 53 53 53 53 53 53 53 53 53 53
- end_of_block_dump
-
- row 0 offset 8072 MacleanZZZZZZZZZZZZZ 24bytes
- row 1 offset 8048 MacleanAAAAAAAAAAAAA 24bytes
- row 2 offset 8024 MacleanSSSSSSSSSSSSS 24bytes
- 即实际存储是
- ---------------
- block header |
- FREE SPACE |
- row2 |
- row1 |
- row0 |
- tail |
- ---------------
- SQL> update test_space set t1='a' where t1='MacleanAAAAAAAAAAAAA';
- 1 row updated.
- SQL> alter system checkpoint;
- System altered.
- tab 0, row 0, @0x1f88
- tl: 24 fb: --H-FL-- lb: 0x0 cc: 1
- col 0: [20] 4d 61 63 6c 65 61 6e 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a
- tab 0, row 1, @0x1f53
- tl: 5 fb: --H-FL-- lb: 0x2 cc: 1
- col 0: [ 1] 61
- tab 0, row 2, @0x1f58
- tl: 24 fb: --H-FL-- lb: 0x0 cc: 1
- col 0: [20] 4d 61 63 6c 65 61 6e 53 53 53 53 53 53 53 53 53 53 53 53 53
- row0 offset 8072 MacleanZZZZZZZZZZZZZ 24bytes
- row1 offset 8019 a 5bytes
- row2 offset 8024 MacleanSSSSSSSSSSSSS 24bytes
- 更新row1 后变成了
- ------------------
- block header |
- FREE SPACE |
- row1 |
- row2 |
- row0 |
- tail |
- ------------------
- row2 出于row1 、 row0之间,对row2做更新 扩展
- SQL> update test_space set t1=rpad('Maclean',80,'Y') where t1='MacleanSSSSSSSSSSSSS';
- 1 row updated.
- SQL> commit;
- Commit complete.
- SQL> alter system checkpoint;
- System altered.
- SQL> alter system dump datafile 1 block 90306;
- System altered.
- tab 0, row 0, @0x1f88
- tl: 24 fb: --H-FL-- lb: 0x0 cc: 1
- col 0: [20] 4d 61 63 6c 65 61 6e 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a
- tab 0, row 1, @0x1f53
- tl: 5 fb: --H-FL-- lb: 0x2 cc: 1
- col 0: [ 1] 61
- tab 0, row 2, @0x1eff
- tl: 84 fb: --H-FL-- lb: 0x1 cc: 1
- col 0: [80]
- 4d 61 63 6c 65 61 6e 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
- 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
- 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
- 59 59 59 59 59
-
-
-
- row0 offset 8072 不变 MacleanZZZZZZZZZZZZZ
- row1 offset 8019 a
- row2 offset 7935
-
- 原row2 被夹在row0 row1之间 更新后原offset 放不下, 所以 row2被移动到 更前面的offset上。
-
-
-
- 尝试更新row1 从24字节 到 23字节 仅缩小一个字节
-
- SQL> update test_space set t1=rpad('Maclean',19,'Z') where t1='MacleanZZZZZZZZZZZZZ';
- 1 row updated.
- SQL> commit;
- Commit complete.
- tab 0, row 0, @0x1ee8
- tl: 23 fb: --H-FL-- lb: 0x2 cc: 1
- col 0: [19] 4d 61 63 6c 65 61 6e 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a
- tab 0, row 1, @0x1f53
- tl: 5 fb: --H-FL-- lb: 0x0 cc: 1
- col 0: [ 1] 61
- tab 0, row 2, @0x1eff
- tl: 84 fb: --H-FL-- lb: 0x0 cc: 1
- col 0: [80]
- 4d 61 63 6c 65 61 6e 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
- 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
- 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
- 59 59 59 59 59
- end_of_block_dump
-
-
-
- row1 24bytes => 23bytes offset 7912
复制代码 |
|