筆者認(rèn)為不能簡(jiǎn)單的說(shuō)物理硬盤(pán)的損壞導(dǎo)致塊的物理?yè)p壞,Oracle bug導(dǎo)致塊的邏輯損壞。這篇文章我們來(lái)詳細(xì)討論一下Oracle數(shù)據(jù)庫(kù)的物理?yè)p壞以及邏輯損壞的概念。下面是一篇METALINK的文章:Physical and Logical Block Corruptions. All you wanted to know about it. [ID 840978.1] |
|
| 修改時(shí)間 21-MAY-2012 類(lèi)型 BULLETIN 狀態(tài) PUBLISHED | |
In this Document
創(chuàng)新互聯(lián)公司-專(zhuān)業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性?xún)r(jià)比黃驊網(wǎng)站開(kāi)發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫(kù),直接使用。一站式黃驊網(wǎng)站制作公司更省心,省錢(qián),快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋黃驊地區(qū)。費(fèi)用合理售后完善,十余年實(shí)體公司更值得信賴(lài)。
| Physical Block Corruptions |
| Logical Block Corruptions |
Applies to:
Oracle Server - Enterprise Edition - Version 9.2.0.1 to 11.2.0.3 [Release 9.2 to 11.2]
Information in this document applies to any platform.
***Checked for relevance on 21-May-2012***
Purpose
Oracle classifies the Data File Block corruptions as Physical and Logical. This is also referred as intra block corruptions. This document is intended to provide detailed information and errors example about it.
Scope
This document is intended for Database Administrators.
Details
Physical Block Corruptions
This kind of block corruptions are normally reported by Oracle with error ORA-1578 and the detailed corruption description is printed in the alert log.
Corruption Examples are:
- Bad header - the beginning of the block (cache header) is corrupt with invalid values
- The block is Fractured/Incomplete - header and footer of the block do not match
- The block checksum is invalid
- The block is misplaced
- Zeroed out blocks / ORA-8103
Detailed Corruption Description:
Fractured Block
A Fractured block means that the block is incomplete. Information from the block header does not match the block tail.
Corrupt block relative dba: 0x0380e573 (file 14, block 58739)
Fractured block found during buffer read
Data in bad block -
type: 6 format: 2 rdba: 0x0380e573
last change scn: 0x0288.8e5a2f78 seq: 0x1 flg: 0x04
consistency value in tail: 0x00780601
check value in block header: 0x8739, computed block checksum: 0x2f00
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
Reread of rdba: 0x0380e573 (file 14, block 58739) found same corrupted data
Bad Checksum
Block Checksums are used to identify if the block was changed by something external to Oracle and after the block was last written by Oracle.
Checksum is calculated by DBWR or direct loader before writing the block to disk and stored in the block header. Every time that the block is read and if db_block_checksum is different than false, Oracle calculates a checksum and compares it to the one stored in the block header. Reference Note 30706.1
Example of a corrupt block due to invalid checksum:
Corrupt block relative dba: 0x0380a58f (file 14, block 42383)
Bad check value found during buffer read
Data in bad block -
type: 6 format: 2 rdba: 0x0380a58f
last change scn: 0x0288.7784c5ee seq: 0x1 flg: 0x06
consistency value in tail: 0xc5ee0601
check value in block header: 0x68a7, computed block checksum: 0x2f00
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
Reread of rdba: 0x0380a58f (file 14, block 42383) found same corrupted data
A value different than zero (0x0) in "computed block checksum" means that the checksum
differs and the result of this comparison is printed.
Block Misplaced
This is when Oracle detected that the content of the block being read belongs to a different block and the checksum is valid:
Corrupt block relative dba: 0x0d805a89 (file 54, block 23177)
Bad header found during buffer read
Data in bad block -
type: 6 format: 2 rdba: 0x0d805b08 ----> Block is different than expected 0x0d805a89
last change scn: 0x0692.86dc08e3 seq: 0x1 flg: 0x04
consistency value in tail: 0x08e30601
check value in block header: 0x2a6e, computed block checksum: 0x0
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
Logical Block Corruptions
This is when block contains a valid checksum and the structure below the beginning of the block is corrupt (Block content is corrupt). It may cause different ORA-600 errors.
The detailed corruption description for Logical Corruptions are not normally printed in the alert.log. DBVerify will report what is logically corrupted in the block.
Corruption Examples are:
- row locked by non-existent transaction - ORA-600 [4512],etc
- the amount of space used is not equal to block size
- avsp bad
- etc.
When db_block_checking is enabled, it may produce the internal errors ORA-600 [kddummy_blkchk] or ORA-600 [kdBlkCheckError].
If db_block_checking is enabled and the block is already logically corrupt on disk, the next block update will mark the block as Soft Corrupt and future reads of this block will produce the error ORA-1578. In that case DBVerify reports this corruption with error "DBV-200: Block, dba , already marked corrupted".
References
NOTE:1088018.1 - Master Note for Handling Oracle Database Corruption Issues
NOTE:1578.1 - OERR: ORA-1578 "ORACLE data block corrupted (file # %s, block # %s)" Master Note
NOTE:28814.1 - Handling Oracle Block Corruptions in Oracle7/8/8i/9i/10g/11g
NOTE:794505.1 - ORA-1578 / ORA-26040 Corrupt blocks by NOLOGGING - Error explanation and solution
NOTE:819533.1 - How to identify the corrupt Object reported by ORA-1578 / RMAN / DBVERIFY
NOTE:836658.1 - Identify the corruption extension using RMAN/DBV/ANALYZE etc
一.物理塊損壞:
各種各樣的塊損壞通常是通過(guò)ORA-1578報(bào)告出來(lái)的,詳細(xì)的信息被記錄在alert日志中。物理?yè)p壞的例子包括:
>壞頭
>塊破壞/不完整 (Fractured Block)
>塊的checksum不正確 (Bad Checksum)
>塊的位置錯(cuò)誤 (Block Misplaced)
>歸零的塊/ORA-8103
二.邏輯塊損壞:
當(dāng)塊包含一個(gè)正確的checksum和結(jié)構(gòu),但是塊頭一下的部分(塊的內(nèi)容)被損壞,可能引起不同的ORA-600錯(cuò)誤。
邏輯損壞詳細(xì)的損壞信息通常不打印在alert日志中,DBV將報(bào)告邏輯損壞的塊。
邏輯損壞的例子包括:
>行被不存在的事務(wù)鎖定-ORA-600[4512]等
>使用的空間大小不等于塊的大小
>avsp bad
>等等
當(dāng)啟用db_block_checking,可能會(huì)產(chǎn)生內(nèi)部錯(cuò)誤ORA-600 [kddummy_blkchk] 或者 ORA-600 [kdBlkCheckError]。
三.DB_BLOCK_CHECKSUM和DB_BLOCK_CHECKING DB_BLOCK_CHECKSUM用于防止物理IO的損壞,默認(rèn)值是TYPICAL,在DBWR進(jìn)程寫(xiě)入磁盤(pán)的時(shí)候會(huì)記錄數(shù)據(jù)的CHECKSUM值,將其存儲(chǔ)在塊頭中,下次在讀取的時(shí)候會(huì)重新計(jì)算塊的CHECKSUM值,與塊頭進(jìn)行比對(duì)以判斷該塊是否損壞。如果將其設(shè)置為FULL,還會(huì)驗(yàn)證內(nèi)存中的塊的CHECKSUM值,避免內(nèi)存的問(wèn)題導(dǎo)致塊的損壞。
即使將DB_BLOCK_CHECKSUM值設(shè)置為FALSE,對(duì)于SYSTEM表空間也會(huì)進(jìn)行相關(guān)的驗(yàn)證。
DB_BLOCK_CHECKING用于邏輯控制塊,
如果db_block_checking是啟用,磁盤(pán)的塊已經(jīng)被邏輯損壞,下一次更新塊將以軟損壞標(biāo)記塊,將來(lái)對(duì)這個(gè)塊的讀將產(chǎn)生ORA-1578錯(cuò)誤,在這種情況下報(bào)告損壞錯(cuò)誤"DBV-200:Block,dba
,already marked corrupted"。
即使將DB_BLOCK_CHECKING值設(shè)置為FALSE,對(duì)于SYSTEM表空間也會(huì)進(jìn)行相關(guān)的驗(yàn)證。
四.驗(yàn)證工具介紹
對(duì)于壞塊的驗(yàn)證主要有兩個(gè)工具DBV和RMAN。
1.DBV工具
DBV是DBVERIFY的縮寫(xiě),它是執(zhí)行物理數(shù)據(jù)結(jié)構(gòu)完整性檢查的外部命令行工具,它能用在脫機(jī)或聯(lián)機(jī)的數(shù)據(jù)庫(kù),也可以用在備份文件上。因?yàn)镈BVERYIFY能對(duì)脫機(jī)數(shù)據(jù)庫(kù)運(yùn)行,完整性檢查速度大幅度提高。DBV檢查被限制在緩存管理的塊(數(shù)據(jù)塊),DBV只用于數(shù)據(jù)文件,不能用于控制文件或Redo日志文件的檢查。
dbv help=y可以看到DBV工具參數(shù)詳細(xì)的幫助信息。
2.RMAN工具
下面是有關(guān)RMAN的VALIDATE命令驗(yàn)證邏輯壞塊和物理壞塊的內(nèi)容:
How to check for physical and logical database corruption using "backup validate check logical database" command for database on a non-archivelog mode [ID 466875.1] |
|
| 修改時(shí)間 30-JUN-2011 類(lèi)型 FAQ 狀�?/em> PUBLISHED | |
In this Document
Purpose
Questions and Answers
Purpose
How can we use this command for a non-archivelog database so we can use this as opposed to the dbv command ?
RMAN> backup validate check logical database;
Questions and Answers
"backup validate check logical database" RMAN command could NOT be used for a non-archivelog database.
RMAN> backup validate check logical database;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_2 channel at 11/06/2007 14:56:31
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
The only way to do that for database on no-archive log mode is to perform. above command while the target database in MOUNT status not OPEN
Additional Information:
------------------------------------
- RMAN restore/backup validate with check logical will ensure that there is no logical and also physical corruption.However , DBV would report only physical corruption.
- If the backup validate discovers corrupt blocks, then RMAN updates the V$DATABASE_BLOCK_CORRUPTION view with rows describing the corruptions.
- After corrupt block is repaired the row identifies this block is deleted from the view.
從上面的描述可以看出,DBV只報(bào)告物理?yè)p壞,validate check logical database可以驗(yàn)證物理?yè)p壞和邏輯損壞,執(zhí)行VALIDATE命令后通過(guò)查詢(xún)V$DATABASE_BLOCK_CORRUPTION視圖可以獲得壞塊的詳細(xì)信息,塊被修復(fù)后V$DATABASE_BLOCK_CORRUPTION中相應(yīng)的記錄會(huì)被刪除。該命令只能運(yùn)行在歸檔模式下的數(shù)據(jù)庫(kù),如果要在非歸檔模式下執(zhí)行該命令,必須使數(shù)據(jù)庫(kù)在MOUNT模式。
執(zhí)行下面的命令能驗(yàn)證歸檔日志的邏輯損壞和物理?yè)p壞:
RMAN > BACKUP VALIDATE CHECK LOGICAL DATABASE ARCHIVELOG ALL;
執(zhí)行下面的命令驗(yàn)證數(shù)據(jù)庫(kù)物理?yè)p壞的塊:
RMAN > BACKUP VALIDATE DATABASE|ARCHIVELOG ALL;
沒(méi)有CHECK LOGICAL關(guān)鍵字的BACKUP命令只會(huì)驗(yàn)證物理?yè)p壞。
本文名稱(chēng):Oracle數(shù)據(jù)庫(kù)塊的物理?yè)p壞與邏輯損壞
文章位置:http://weahome.cn/article/jspphd.html