SQL> create table t as select * from dba_objects;
表已创建。
SQL> create index t_idx on t(object_name);
索引已创建。
SQL> alter system checkpoint;
系统已更改。
SQL> select header_file,header_block from dba_segments where segment_name='T_IDX';
HEADER_FILE HEADER_BLOCK
----------- ------------
4 1154
SQL> alter system dump datafile 4 block 1156;
系统已更改。
row#0[7996] flag: ------, lock: 0, len=40
col 0; len 30; (30):
2f 31 30 30 30 33 32 33 64 5f 44 65 6c 65 67 61 74 65 49 6e 76 6f 63 61 74
69 6f 6e 48 61
col 1; len 6; (6): 01 00 02 66 00 1b
这个是索引中存储的ROWID信息,但是,具体指向的是哪里呢?
实际上rowid包含以下内容:32位object_id,10位file#,22位block#,16位row#
对于普通索引而言,没有32位的object_id
我们只需要将"01 00 02 66 00 1b”转换为2进制,截取相应的长度即可找出具体的指向。
SQL> select idx_rowid('01 00 02 66 00 1b') from dual;
IDX_ROWID('01000266001B')
--------------------------------------------------------------------------------
File# = 4, Block# = 614, Row# = 27
SQL> alter system dump datafile 4 block 614;
系统已更改。
tab 0, row 27, @0x1421
tl: 107 fb: --H-FL-- lb: 0x0 cc: 14
col 0: [ 3] 53 59 53
col 1: [30]
2f 31 30 30 30 33 32 33 64 5f 44 65 6c 65 67 61 74 65 49 6e 76 6f 63 61 74
69 6f 6e 48 61
col 2: *NULL*
col 3: [ 4] c3 04 29 2b
col 4: *NULL*
col 5: [10] 4a 41 56 41 20 43 4c 41 53 53
col 6: [ 7] 78 6e 05 19 0e 0c 1a
col 7: [ 7] 78 6e 05 19 0e 0c 1a
col 8: [19] 32 30 31 30 2d 30 35 2d 32 35 3a 31 33 3a 31 31 3a 32 35
col 9: [ 5] 56 41 4c 49 44
col 10: [ 1] 4e
col 11: [ 1] 4e
col 12: [ 1] 4e
col 13: [ 2] c1 02
tab 0, row 28, @0x13b6
SQL> select idx_rowid('01 00 02 66 00 1b') from dual;
IDX_ROWID('01000266001B')
--------------------------------------------------------------------------------
File# = 4, Block# = 614, Row# = 27
SQL> alter system dump datafile 4 block 614;
系统已更改。
tab 0, row 27, @0x1421
tl: 107 fb: --H-FL-- lb: 0x0 cc: 14
col 0: [ 3] 53 59 53
col 1: [30]
2f 31 30 30 30 33 32 33 64 5f 44 65 6c 65 67 61 74 65 49 6e 76 6f 63 61 74
69 6f 6e 48 61
col 2: *NULL*
col 3: [ 4] c3 04 29 2b
col 4: *NULL*
col 5: [10] 4a 41 56 41 20 43 4c 41 53 53
col 6: [ 7] 78 6e 05 19 0e 0c 1a
col 7: [ 7] 78 6e 05 19 0e 0c 1a
col 8: [19] 32 30 31 30 2d 30 35 2d 32 35 3a 31 33 3a 31 31 3a 32 35
col 9: [ 5] 56 41 4c 49 44
col 10: [ 1] 4e
col 11: [ 1] 4e
col 12: [ 1] 4e
col 13: [ 2] c1 02
tab 0, row 28, @0x13b6
[ 本帖最后由 sundog315 于 2010-6-25 13:43 编辑 ]
表已创建。
SQL> create index t_idx on t(object_name);
索引已创建。
SQL> alter system checkpoint;
系统已更改。
SQL> select header_file,header_block from dba_segments where segment_name='T_IDX';
HEADER_FILE HEADER_BLOCK
----------- ------------
4 1154
SQL> alter system dump datafile 4 block 1156;
系统已更改。
row#0[7996] flag: ------, lock: 0, len=40
col 0; len 30; (30):
2f 31 30 30 30 33 32 33 64 5f 44 65 6c 65 67 61 74 65 49 6e 76 6f 63 61 74
69 6f 6e 48 61
col 1; len 6; (6): 01 00 02 66 00 1b
这个是索引中存储的ROWID信息,但是,具体指向的是哪里呢?
实际上rowid包含以下内容:32位object_id,10位file#,22位block#,16位row#
对于普通索引而言,没有32位的object_id
我们只需要将"01 00 02 66 00 1b”转换为2进制,截取相应的长度即可找出具体的指向。
SQL> select idx_rowid('01 00 02 66 00 1b') from dual;
IDX_ROWID('01000266001B')
--------------------------------------------------------------------------------
File# = 4, Block# = 614, Row# = 27
SQL> alter system dump datafile 4 block 614;
系统已更改。
tab 0, row 27, @0x1421
tl: 107 fb: --H-FL-- lb: 0x0 cc: 14
col 0: [ 3] 53 59 53
col 1: [30]
2f 31 30 30 30 33 32 33 64 5f 44 65 6c 65 67 61 74 65 49 6e 76 6f 63 61 74
69 6f 6e 48 61
col 2: *NULL*
col 3: [ 4] c3 04 29 2b
col 4: *NULL*
col 5: [10] 4a 41 56 41 20 43 4c 41 53 53
col 6: [ 7] 78 6e 05 19 0e 0c 1a
col 7: [ 7] 78 6e 05 19 0e 0c 1a
col 8: [19] 32 30 31 30 2d 30 35 2d 32 35 3a 31 33 3a 31 31 3a 32 35
col 9: [ 5] 56 41 4c 49 44
col 10: [ 1] 4e
col 11: [ 1] 4e
col 12: [ 1] 4e
col 13: [ 2] c1 02
tab 0, row 28, @0x13b6
SQL> select idx_rowid('01 00 02 66 00 1b') from dual;
IDX_ROWID('01000266001B')
--------------------------------------------------------------------------------
File# = 4, Block# = 614, Row# = 27
SQL> alter system dump datafile 4 block 614;
系统已更改。
tab 0, row 27, @0x1421
tl: 107 fb: --H-FL-- lb: 0x0 cc: 14
col 0: [ 3] 53 59 53
col 1: [30]
2f 31 30 30 30 33 32 33 64 5f 44 65 6c 65 67 61 74 65 49 6e 76 6f 63 61 74
69 6f 6e 48 61
col 2: *NULL*
col 3: [ 4] c3 04 29 2b
col 4: *NULL*
col 5: [10] 4a 41 56 41 20 43 4c 41 53 53
col 6: [ 7] 78 6e 05 19 0e 0c 1a
col 7: [ 7] 78 6e 05 19 0e 0c 1a
col 8: [19] 32 30 31 30 2d 30 35 2d 32 35 3a 31 33 3a 31 31 3a 32 35
col 9: [ 5] 56 41 4c 49 44
col 10: [ 1] 4e
col 11: [ 1] 4e
col 12: [ 1] 4e
col 13: [ 2] c1 02
tab 0, row 28, @0x13b6
[ 本帖最后由 sundog315 于 2010-6-25 13:43 编辑 ]
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/19423/viewspace-666262/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/19423/viewspace-666262/