参数DB_BLOCK_CHECKSUM和DB_BLOCK_CHECKING的说明

    db_block_checking与db_block_checksum两个参数都是对block进行检查,然而两者很容易混淆。事实上,两个参数中前者是对块做逻辑性检查,后者则是做物理性检查。两者各司其职,并不矛盾。下面分别给出具体描述。

1.db_block_checking

    db_block_checking 是当block发生任何变化的时候进行逻辑上的完整性和正确性检查。该参数能够避免内存中数据块的损坏。块的检查将对系统会有1%到10%的性能影响。取决于对db_block_checking参数的设置。频繁的DML将使得块检查带来更多的开销。在系统负荷允许的情形下建议设置为full。该参数对SYSTEM表空间始终是处于“打开”状态,而不管该参数是否设置为OFF。下面是该参数的置参考。FALSE和TRUE是为了老版本的兼容。

Property Description
Parameter type String
Syntax DB_BLOCK_CHECKSUM = { OFF | FALSE | TYPICAL | TRUE | FULL }
Default value TYPICAL
Modifiable ALTER SESSIONALTER SYSTEM
Basic No

DB_BLOCK_CHECKING specifies whether or not Oracle performs block checking for database blocks.

Values:

  • OFF or FALSE

    No block checking is performed for blocks in user tablespaces. However, semantic block checking for SYSTEM tablespace blocks is always turned on.

  • LOW

    Basic block header checks are performed after block contents change in memory (for example, after UPDATE or INSERT statements, on-disk reads, or inter-instance block transfers in Oracle RAC).基本块头检查是在内存块内容更改之后执行的(例如,在Oracle RAC中更新或插入语句、磁盘读操作或实例间块传输之后)。

  • MEDIUM

    All LOW checks and full semantic checks are performed for all objects except indexes (whose contents can be reconstructed by a drop+rebuild on encountering a corruption).除了索引外,所有对象都要执行所有的LOW检查和全语义检查(其内容可以在遇到损坏时通过drop+rebuild进行重构)

  • FULL or TRUE

    扫描二维码关注公众号,回复: 2808022 查看本文章

    All LOW and MEDIUM checks and full semantic checks are performed for all objects.

Oracle checks a block by going through the data in the block, making sure it is logically self-consistent. Block checking can often prevent memory and data corruption. Block checking typically causes 1% to 10% overhead, depending on workload and the parameter value. Specific DML overhead may be higher. 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 FULLif the performance overhead is acceptable.

For backward compatibility, the use of FALSE (implying OFF) and TRUE (implying FULL) is preserved.

--对于向后兼容性,保留TRUE(表示FULL)和FALSE(表示OFF)值的使用。

2.db_block_checksum

        db_block_checksum 用于DBWn和direct loader数据块写入到磁盘时,基于块内的所有字节计算得出一个校验值并将其写入块头

   在该参数设置为typical和full时,当读入时候重新计算校验和写出时候的校验对比,如果不同则认为是块损坏。如果设置为FULL模式,则基于update/delete应用程序语句级别的改变发生后,校验值会被重新计算并写入。同时对于日志块,在写入之前,同样会生产校验值并写入到块头。该参数主要是防止IO硬件和IO子系统的错误。如果设置为OFF则只对系统表空间有效。下面是该参数的设置参考。

Property Description
Parameter type String
Syntax DB_BLOCK_CHECKSUM = { OFF | FALSE | TYPICAL | TRUE | FULL }
Default value TYPICAL
Modifiable ALTER SESSIONALTER SYSTEM
Basic No

 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 TYPICAL or FULL and the last write of the block stored a checksum.

--DB_BLOCK_CHECKSUM 参数决定了DBWn进程和直接路径读取进程是否为块计算checksum并将该checksum存放在每个数据块的cache header并写入到磁盘中。当该数据块被读取时,该checksum会受到验证, 前提是DB_BLOCK_CHECKSUM 被设置为TYPICAL 或 FULL,且最近一次该块的写出中存有checksum。

In FULL mode, Oracle also verifies the checksum before a change application from update/delete statements and recomputes it after the change is applied. In addition, Oracle gives every log block a checksum before writing it to the current log.

--在FULL模式下,Oracle还会当块要发生变化应用前对该块验证checksum,并会在DML update/insert/delete语句引起变化被应用到块后再次计算该checksum。此外,Oracle会对写入到当前redo日志文件的每一个redo block计算checksum。

Starting with Oracle Database 11g, most of the log block checksum is done by the generating foreground processes, while the LGWR performs the rest of the work, for better CPU and cache efficiency. Prior to Oracle Database 11g, the LGWR solely performed the log block checksum.

--从Oracle Database 11g开始,大多数日志块校验和都是通过生成前台进程完成的,而LGWR执行其余的工作,以提高CPU和缓存效率。在Oracle数据库11g之前,LGWR只执行日志块校验和。

If this parameter is set to OFFDBWn calculates checksums only for the SYSTEM tablespace, but not for user tablespaces. In addition, no log checksum is performed when this parameter is set to OFF.

--若该参数设置为OFF,则 DBWn进程仅为system表空间上的对象计算checksum, 而对于普通表空间不计算。

Checksums allow Oracle to detect corruption caused by underlying disks, storage systems, or I/O systems. If set to FULLDB_BLOCK_CHECKSUM also catches in-memory corruptions and stops them from making it to the disk. Turning on this feature in TYPICAL mode causes only an additional 1% to 2% overhead. In the FULL mode it causes 4% to 5% overhead. Oracle recommends that you set DB_BLOCK_CHECKSUM to TYPICAL.

--checksum让Oracle具备检测由底层磁盘、存储子系统、IO子系统引起的坏块。若设置为FULL, 则DB_BLOCK_CHECKSUM还会捕捉内存讹误并避免将存在逻辑讹误的块被写入到磁盘上。设置DB_BLOCK_CHECKSUM为TYPICAL模式可能引起1%-2%的性能损耗,设置为FULL mode可能引起4%-5%的性能损耗。Oracle推荐用户设置DB_BLOCK_CHECKSUM为TYPICAL。

For backward compatibility the use of TRUE (implying TYPICAL) and FALSE (implying OFF) values is preserved.

--对于向后兼容性,保留TRUE(表示TYPICAL)和FALSE(表示OFF)值的使用。

3.另一个参数 DB_ALWAYS_CHECK_SYSTEM_TS

db_block_checking与db_block_checksum两个参数都是对block进行检查,区别就是db_block_checking是对block做逻辑性检查,所谓逻辑性检查直白点说就是对数据块在内存提供一致性验证,确保每一个数据块的完整性。db_block_checksum是对block做物理性检查,所谓物理性检查直白点说就是通过校验结构够保证写入到数据文件与从数据文件读取的块前后两者是一致的。通常对于侦测由于IO操作(磁盘损坏,硬件损坏)引发的坏块。但它并不侦测在内存中已经出错的数据块。不管错误与否,DBWn后会将其写入到数据文件。不管db_block_checking和db_block_checksum这两个参数的值为何值,SYSTEM表空间都会进行做checking和checksum,除非把隐含参数_db_always_check_system_ts设置为FALSE,当然Oracle是不建议修改隐藏参数的。

参考:https://blog.csdn.net/leshami/article/details/6628679

http://blog.sina.com.cn/s/blog_96d348df0102v0rz.html

猜你喜欢

转载自blog.csdn.net/jolly10/article/details/81475127
DB
今日推荐