ITPub博客

首页 > Linux操作系统 > Linux操作系统 > db_block_checksum & db_block_checking

db_block_checksum & db_block_checking

原创 Linux操作系统 作者:sxzhanghl 时间:2009-04-13 15:31:25 0 删除 编辑

db_block_checksum & db_block_checking

 

首先看两个参数的定义:
DB_BLOCK_CHECKSUM

DB_BLOCK_CHECKSUM determines whether DBWn and the direct loader will calculate a checksum (a number calculated from all the bytes stored in the block) and store it in the cache header of every data block when writing it to disk. Checksums are verified when a block is read-only if this parameter is true and the last write of the block stored a checksum. In addition, Oracle gives every log block a checksum before writing it to the current log.

If this parameter is set to false, DBWn calculates checksums only for the SYSTEM tablespace, but not for user tablespaces.

Checksums allow Oracle to detect corruption caused by underlying disks, storage systems, or I/O systems. Turning on this feature typically causes only an additional 1% to 2% overhead. Therefore, Oracle Corporation recommends that you set DB_BLOCK_CHECKSUM to true.

DB_BLOCK_CHECKING

DB_BLOCK_CHECKING controls whether Oracle performs block checking for data blocks. When this parameter is set to true, Oracle performs block checking for all data blocks. When it is set to false, Oracle does not perform. block checking for blocks in the user tablespaces. However, block checking for the SYSTEM tablespace is always turned on.



Oracle checks a block by going through the data on the block, making sure it is self-consistent. Block checking can often prevent memory and data corruption. Block checking typically causes 1% to 10% overhead, depending on workload. The more updates or inserts in a workload, the more expensive it is to turn on block checking. You should set DB_BLOCK_CHECKING to true if the performance overhead is acceptable.

这两个参数的含义经常让人混淆,虽然都是对block进行检查。
db_block_checksum 是在将数据块写到数据文件的时候对block内数据做一个校验写在块头,当读入时候重新计算校验和写出时候的校验对比,如果不同则认为是块损坏。这通常应该是由于脱离oracle以外在os或者硬件中出现了损坏,如果设置为false则只对系统表空间有效。从8i开始设置为true的时候也同时对log block进行校验。

db_block_checking 是当block发生任何变化的时候进行逻辑上的完整性和正确性检查,这在内存中进行,当发现错误就立即回退,设置为false则只对系统表空间有效。

这意味着,如果db_block_checking = false ,非系统表空间中数据在逻辑上可能已经损坏,但是 db_block_checksum 却是无法检查出来的,原样写到磁盘原样读到内存,因为它只校验块在写出后和读入之间是否发生变化而不检查写出前是否存在 逻辑上的正确。

比如有时索引块损坏,造成通过索引无法获得数据,但是读索引块的时候并没有出1578错误,可能就是这个原因。

关于这两个参数,也可以参考tom的解释:
http://asktom.oracle.com/pls/ask/f?p=4950:8:17926674857995971206::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:1094433279412

 

 

 

Try to repair this problem:

1:ALTER SYSTEM SET EVENTS='10231 trace name context forever,level 10' ;
2:DBMS_REPAIR

Both mathod will lost some data.

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

请登录后发表评论 登录
全部评论

注册时间:2009-03-19

  • 博文量
    31
  • 访问量
    58587