我开始本以为他说的这个块是空块,但从他随后的留言可以看出,这个块并不是空块。
其实在oracle里一个块的checksum值完全有可能是0的,我们来看一个实例:
BBED> set file 4
FILE# 4
BBED> set block 32
BLOCK# 32
可以看到现在这个块的checksum值是0x9339
BBED> dump
File: /dras20/testdb/drsys01.dbf (4)
Block: 32 Offsets: 0 to 511 Dba:0x01000020
------------------------------------------------------------------------
06020000 01000020 0002052e 00000204 93390000 0106001d 0000672f 0002052e
00008aa8 00023200 01000019 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 ffff000e 1f981f8a 1f8a0000 00000000 0006000d 000000d1
......省略显示部分内容
1b011b12 1b231b34 1b451b56 1b671b78 1b891b9a 1bab1bbc 1bcd1bde 1bef1c00
<32 bytes per line>
这个块是一个完好的块:
BBED> verify
DBVERIFY - Verification starting
FILE = /dras20/testdb/drsys01.dbf
BLOCK = 32
DBVERIFY - Verification complete
Total Blocks Examined : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing (Index): 0
Total Blocks Empty : 0
Total Blocks Marked Corrupt : 0
Total Blocks Influx : 0
现在我们来让其checksum值变为0:
BBED> set offset 64
OFFSET 64
BBED> dump
File: /dras20/testdb/drsys01.dbf (4)
Block: 32 Offsets: 64 to 575 Dba:0x01000020
------------------------------------------------------------------------
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 ffff000e 1f981f8a 1f8a0000 00000000 0006000d 000000d1
00806849 002f5600 00020000 00000000 0e000000 00409018 004003e1 00018503
......省略显示部分内容
1d1f1d30 1d401d51 1d621d73 1d841d95 1da61db7 1dc81dd9 1dea1dfb 1e0c1e1d
<32 bytes per line>
BBED> modify /x 9339
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /dras20/testdb/drsys01.dbf (4)
Block: 32 Offsets: 64 to 575 Dba:0x01000020
------------------------------------------------------------------------
93390000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 ffff000e 1f981f8a 1f8a0000 00000000 0006000d 000000d1
00806849 002f5600 00020000 00000000 0e000000 00409018 004003e1 00018503
......省略显示部分内容
1d1f1d30 1d401d51 1d621d73 1d841d95 1da61db7 1dc81dd9 1dea1dfb 1e0c1e1d
<32 bytes per line>
注意到oracle这里已经提示我新算出来的checksum值就是0了:
BBED> sum apply
Check value for File 4, Block 32:
current = 0x0000, required = 0x0000
可以看到现在这个块的checksum值就是0x0000
BBED> dump
File: /dras20/testdb/drsys01.dbf (4)
Block: 32 Offsets: 0 to 511 Dba:0x01000020
------------------------------------------------------------------------
06020000 01000020 0002052e 00000204 00000000 0106001d 0000672f 0002052e
00008aa8 00023200 01000019 00000000 00000000 00000000 00000000 00000000
93390000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
......省略显示部分内容
1b011b12 1b231b34 1b451b56 1b671b78 1b891b9a 1bab1bbc 1bcd1bde 1bef1c00
<32 bytes per line>
修改后的这个块也是一个完好的块:
BBED> verify
DBVERIFY - Verification starting
FILE = /dras20/testdb/drsys01.dbf
BLOCK = 32
DBVERIFY - Verification complete
Total Blocks Examined : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing (Index): 0
Total Blocks Empty : 0
Total Blocks Marked Corrupt : 0
Total Blocks Influx : 0
这种现象其实本质是由oracle的checksum值算法决定的。