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

Oracle corrupt block recovery - 思路及方法

2013-08-16 09:26 726 查看
##########################

Oracle corrupt block处理思路

##########################


Oracle坏块分为:逻辑坏块,物理坏块。如果是物理坏块,则需更换磁盘,再进行恢复。

My Oracle Support(MOS)上有一篇详细的文档,对corrupt block的处理方法进行了分析,现以这篇官方文档为参考,对处理过程进行小结。

Handling Oracle Block Corruptions in Oracle7/8/8i/9i/10g/11g (文档 ID 28814.1)

1,检测到corrupt block所在的数据文件的extent,该步骤还有1个目的,根据系统日志,数据库日志,判断坏块是物理坏块还是逻辑坏块。

DBVERIFY这个工具,可以帮助检查到坏块,该工具的使用可以参考MOS文档[35512.1]DBVERIFY - Database file Verification Utility (7.3.2 - 11.2) (文档 ID 35512.1)

dbv file=/prod/oracle/oradata/TEST/users.257.817171937

2,根据上面的检测,如果是物理坏块,则需要先解决硬件故障,将数据文件转移至OK的磁盘,在进行数据恢复。

You can move datafiles about using the following steps:

1. Make sure the file to be relocated is either OFFLINE or

the instance is in the MOUNT state (not open)

2. Physically restore (or copy) the datafile to its new location

eg: /newlocation/myfile.dbf

3. Tell Oracle the new location of the file.

eg: ALTER DATABASE RENAME FILE '/oldlocation/myfile.dbf' TO '/newlocation/myfile.dbf';

(Note that you cannot RENAME a TEMPFILE - TEMPFILEs should be dropped and recreated at the new location)

4. Online the relevant file / tablespace (if database is open)

3,确定哪些对象受到影响,根据不同的segment_type确定处理的思路。

SELECT tablespace_name, segment_type, owner, segment_name

FROM dba_extents

WHERE file_id = &AFN

AND &BL between block_id AND block_id + blocks - 1;

4,根据3确定的对象与思路进行恢复。

数据段优先考虑的恢复方式

a,rman完全恢复。

b,extract数据重建表:exp/expdp或者select等方式。

但一般需要使用DBMS_REPAIR.SKIP_CORRUPT_BLOCKS 或 Event 10231跳过坏块,参考MOS文档[33405.1]Extracting Data from a Corrupt Table using DBMS_REPAIR or Event 10231 (文档 ID 33405.1)

c,MOS文档外其他方式修复:如bbed等第三方的修复,但无Oracle官方支持。

##############################

Oracle corrupt block处理方法详解

##############################


RMAN中使用blockrecover datafile &AFN bock &BL;

DBMS_REPAIR的使用。

ROWID Rang Scan方式使用。

明白一点:以上所有的处理方法,只有rman是可以完全恢复数据的,其他方式只能保证尽可能的恢复数据。说明做好数据库的rman全备份,保护好归档与在线日志文件文件才是硬道理。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: