oracle_数据库坏块类型以及坏块处理

标签:
blockcorruptrecoverit杂谈 |
分类: bbed |
本文将讲解数据库中块的类型,以及各种块出现损坏(模拟坏块)的处理流程。
数据库中基本对象就是段,段表示有真实大小,在oracle中段的类型为
dba_segments.segment_type
SEGMENT_TYPE VARCHAR2(18) Type of
segment:
只要是上面列出的类型段,分配其中的块都有可能出现损坏。
引起损坏块的原因包括:
当数据库报错坏块后,根源往往不容易发现,需要做的是尽快恢复生产,步骤如下
决定损坏受影响的区和判断损坏是持久还是临时的
替换或离开任何错误或怀疑的硬件环境
判断哪些数据库对象受影响
选择合适的数据库恢复或数据保留策略
由于NOLOGGING或UNRECOVERABLE的损坏
涉及对象会报坏块ORA-1578错误,在8i之后ORA-26040错误会产生。
块损坏类型包括物理损坏和逻辑损坏
物理损坏,块损坏实例:
逻辑损坏,块损坏实例:
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:
A corrupt block is a block that has been changed so that it
differs from what Oracle Database expects to find. This note covers
three data block corruption types:
Block corruptions can also be divided into interblock
corruption and intrablock corruption:
write lost介绍
《oracle_数据丢失写故障及处理 &
DB_LOST_WRITE_PROTECT》
table/index data
inconsistent
《oracle_数据库坏块之TABLE/INDEX不一致模拟 》
坏块处理流程:首先,坏块后在无备份情况下就没有办法保障数据的完整性,dbv和rman检查坏块。
1.检查是否有硬件上的IO问题,是否是硬件导致
2.尽可能多的记录坏块信息,AFN,RFN,FILE,Block#,object,object_type
2.在有备份的情况下采用blockrecover,datafile,database级别的恢复,BR但是只针对普通表块,无法对系统块操作;
3.没有备份的情况,只能是补救数据, (只针对普通段)
通过dbms_repair..skip_corrpt_blocks(owner,tab) 跳过表上坏块备份数据
通过10231事件设置跳过表上坏块备份数据
索引数据可以进行索引重建
4.rowid方式备份数据
SELECT dbms_rowid.rowid_created(1,OID,RFN,BL,0) low_rowid FROM
dual;
SELECT dbms_rowid.rowid_created(1,OID,RFN,BL 1,0) high_rowid
FROM dual;
INSERT INTO TABLE SELECT * FROM table WHERE
rowid high_rowid
5.索引中找回丢失数据
如果是NOT NULL字段可以
SELECT /index_ffs()/ FROM table WHERE rowid high_rowid;
NULL字段
SELECT /index()/ FROM table WHERE rowid high_rowid;
6.logminer技术找回数据
7.DUL工具
上面是常规处理流程,也存在非常规的处理bbed.在后续的文章中会进行介绍。