物理坏块与逻辑坏块(Physical and Logical Block Corruptions)

坏块被分为物理坏块和逻辑坏块

(一)   物理坏块

物理坏块通常会报ORA-1578错误,并在alert.log中记录详细信息

常见的形式如下:

  • 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 

详细描述如下:

1)  Fractured Block

表明block的头部和尾部不匹配,证明该block的信息是不完整的,trace包含如下信息

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

2)  Bad Checksum

Block 在写入的时候会进行blockChecksums(该功能由参数db_block_checksum控制 默认为true) 并把效验值记入block头部,每次block由硬盘读入内存的的时候,oracle计算block效验值是否和block的头部的信息是否一致。

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.

3)  Block Misplaced

Checksum有效但是block的内容属于其他block,trace 包含如下信息

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 ----&gt 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
***

(二)   逻辑坏块

Checksum有效,但是block内容不一致,通常引起ORA-600错误

: ORA-00600 [13013], [5001] (Doc ID 816784.1) 
逻辑坏块常见形式:

  • row locked by non-existent transaction - ORA-600 [4512], etc
  • the amount of space used is not equal to block size
  • avsp bad
  • etc.

db_block_checking设置为true,会报如下错误

ORA-600 [kddummy_blkchk] or ORA-600 [kdBlkCheckError].如果磁盘上的block已经有逻辑坏块,block下次被更新的时候,将被标记为Soft Corrupt 将来被读的时候报ORA-1578, DBVerify将报错误"DBV-200: Block, dba , already marked corrupted".

效验工具

1)  RMAN方式

数据库

backup validate database;--不加check logical选项仅检测物理坏块

backup check logical validate database;

坏块信息记录到V$DATABASE_BLOCK_CORRUPTION

数据库+归档日志

BACKUP VALIDATE DATABASE ARCHIVELOG ALL

BACKUP VALIDATE CHECK LOGICAL DATABASE ARCHIVELOG ALL;

针对备份文件

RESTORE DATABASE VALIDATE;

RESTORE ARCHIVELOG ALL VALIDATE;

坏块恢复恢复

BLOCKRECOVER DATAFILE 3 BLOCK 121;

BLOCKRECOVER CORRUPTION LIST; 恢复V$DATABASE_BLOCK_CORRUPTION中所有坏块

2)  DBVerify 方式

默认检测物理和逻辑坏块

dbv file= blocksize=

3)  ANALYZE .. VALIDATE STRUCTURE方式

analyze table

4)  DBMS_REPAIR 方式

发现、标识并修改数据文件中的坏块,但使用这个包的同时会带来数据丢失、表和索引返回数据不一致,完整性约束破坏等其他问题,因此,dbms_repair只是在没有备份的情况下使用的一种手段,这种方式一般都会造成数据的丢失,dbms_repair包的工作原理比较简单,是将检查到的坏块标注出来,使随后的dml操作跳过该块
           
详细操作:参考

http://docs.oracle.com/cd/B19306_01/server.102/b14231/repair.htm#i1006373

 


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

oracle坏块Block Corruptions
请登录后发表评论 登录
全部评论
<%=items[i].createtime%>

<%=items[i].content%>

<%if(items[i].items.items.length) { %>
<%for(var j=0;j
<%=items[i].items.items[j].createtime%> 回复

<%=items[i].items.items[j].username%>   回复   <%=items[i].items.items[j].tousername%><%=items[i].items.items[j].content%>

<%}%> <%if(items[i].items.total > 5) { %>
还有<%=items[i].items.total-5%>条评论) data-count=1 data-flag=true>点击查看
<%}%>
<%}%> <%}%>

转载于:http://blog.itpub.net/15747463/viewspace-1062378/

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2020-07-28
  • 2022-12-23
  • 2022-12-23
  • 2021-10-06
  • 2022-12-23
  • 2021-06-18
猜你喜欢
  • 2021-07-25
  • 2021-10-20
  • 2021-10-08
  • 2021-09-11
相关资源
相似解决方案