您的位置:首页 > 数据库 > Oracle

ORACLE DB_BLOCK_CHECKING

2014-11-25 18:09 489 查看
参数概述

DB_BLOCK_CHECKING

初始化参数DB_BLOCK_CHECKING用于控制是否检查损坏数据块,默认值为FALSE(向后兼容)。当设置该参数为FALSE时,Oracle不会检查表空间的损坏块;当设置该参数为TRUE(向后兼容)时,Oracle会检查表空间是否存在损坏块。

参数类型:

String

默认值:

OFF

允许动态修改:

ALTER SESSION, ALTER SYSTEM

取值范围:

OFF | LOW | MEDIUM | FULL

基本参数:



参数详解:

DB_BLOCK_CHECKING参数用于控制Oracle是否检查数据块损坏。这个检查将由你提供的参数值来决定,如下所示:

OFF –
用户表空间不执行数据块检查。但SYSTEM表空间的语义块检查始终是开启的

LOW –
内存中数据块内容改变后进行基本的数据块头的检查。比如,UPDATE或INSERT语句后,磁盘读操作,或者实例间的数据块传输

MEDIUM –
完成LOW级别的检查,并且为所有的非索引组织表数据块做语义块检查

FULL – 完成LOW和MEDIUM级别的检查,并且为索引数据块做语义检查

Oracle通过数据块中的数据来检查数据块,以确保它的逻辑一致性。数据块检查常常可以防止内存和数据损坏。数据块检查(根据工作量和参数值)通常会导致1%至10%的开销。更新和插入越多,那么执行数据块检查就会越昂贵。如果性能负担允许的话,你应该将DB_BLOCK_CHECKING参数设为FULL。为了向后兼容性,我们保留了FALSE(相当于OFF)和TRUE(相当于FULL)的可选值。

用法举例:

参数db_block_checking是动态参数,可以使用ALTER SESSION或ALTER
SYSTEM命令进行修改。示例如下:

SQL>ALTER SESSION SET db_block_checking=TRUE;


转自:http://www.qian01ye.com/2012/09/22/db_block_checking/

[align=center]
[/align]

以下来自另一文

[align=center]
[/align]

Oracle db_block_checking和db_block_checksum 两个参数区别

先看看Oracle文档上对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

从文档中可以看到,DB_BLOCK_CHECKING参数主要是用于数据块的逻辑(一致)检查(但只是块内,不包括块间的逻辑检查,比如索引项目的
ROWID指向的是不存在的行等)。主要用于防止在内存中损坏或数据损坏。由于是逻辑检查,因此引起的额外负荷比较高,甚至可以达到10%,因此对于一个繁忙的系统,特别是插入或更新操作很多的系统,性能影响是比较明显的。

该参数对SYSTEM表空间始终是处于“打开”状态,而不管该参数是否设置为FALSE。

下面再看看db_block_checksum参数的说明:

DB_BLOCK_CHECKSUMdetermines whether DBWnand the direct
loader will calculate achecksum(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
,
DBWncalculates 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_CHECKSUM只是在写入(DBWn常规写法或用户进程直接路径写入),根据一个CHECKSUM算法,计算数据块的校验和。然后写入数据块的一个特定位置(CACHE
HEADER,具体是块的16-17字节,以0字节起算)。在读取块时,再进行检验。主要是防止IO硬件和IO子系统的错误。


CHECKSUM的算法只是根据块的字节值计算一个效验和,因此算法比较简单,引起的系统额外负荷通常在1%-2%


实际上,即使将该参数设为TRUE,将数据块(包括SYSTEM表空间)的16-17字节清0,同时将15字节(flag),第3位(即值为16进制
0x04)清为0,则在块读取时也不会做CHECKSUM检查。如果该参数为FALSE,对于除SYSTEM的其他表空间,如果原来有CHECKSUM
值,将15-16字节清0也不会做CHECKSUM检查。


转自:http://www.cnblogs.com/killkill/archive/2009/12/12/1622738.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: