eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« How to simulate block corruption with BBED? | Blog首页 | EMC Disk Fault Again and Again »

How to repair corruption block use BBED?
modb.pro

前面我已经介绍了如何使用BBED模拟坏块,本文简要介绍如何使用BBED修复损坏的BLOCK。

1.备份数据文件
要想恢复损坏的文件,需要存在一个良好文件,本文简单冷备份一下文件.
[oracle@jumper conner]$ cp users01.dbf users01.dbf.bak

2.修改BBED参数文件
加入备份文件

[oracle@jumper conner]$ vi filelist.txt 

         1 /opt/oracle/oradata/conner/system01.dbf       440401920
         2 /opt/oracle/oradata/conner/undotbs01.dbf      104857600
         3 /opt/oracle/oradata/conner/users01.dbf        27262976
         4 /opt/oracle/oradata/conner/users01.dbf.bak    27262976
~
~
~
"filelist.txt" 4L, 259C written    



3.破坏数据块
[oracle@jumper conner]$ bbed parfile=par.bbd 
Password: 

BBED: Release 2.0.0.0.0 - Limited Production on Sun Sep 11 22:30:11 2005

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED> set file 3
        FILE#           3

BBED> modify 1000 file 3 block 17
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) Y
 File: /opt/oracle/oradata/conner/users01.dbf (3)
 Block: 17               Offsets:    0 to  511           Dba:0x00c00011
------------------------------------------------------------------------
 03e80000 1100c000 75b5a320 00000104 06300000 01000000 611e0000 72b5a320 
 00000000 03003201 0900c000 ffff0000 00000000 00000000 00000000 00800000 
 72b5a320 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00012600 
 ffff5e00 d5037703 77030000 2600c21e 101e581d a91cf61b 471b941a dd192819 
 6218b417 06175216 9715dd14 26146c13 b4120712 44118310 bc0ffa0e 380e790d 
 b60cf40b 350b790a c0090409 45088b07 cc060e06 57059804 d5030000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 <32 bytes per line>

BBED> verify
DBVERIFY - Verification starting
FILE = /opt/oracle/oradata/conner/users01.dbf
BLOCK = 17

Block 17 is corrupt
***
Corrupt block relative dba: 0x00c00011 (file 0, block 17)
Bad header found during verification
Data in bad block -
 type: 3 format: 0 rdba: 0x00c00011
 last change scn: 0x0000.20a3b575 seq: 0x1 flg: 0x04
 consistency value in tail: 0xb5750601
 check value in block header: 0x3006, computed block checksum: 0xea05
 spare1: 0x0, spare2: 0x0, spare3: 0x0
***


DBVERIFY - Verification complete

Total Blocks Examined         : 1
Total Blocks Processed (Data) : 0
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 1
Total Blocks Influx           : 0

BBED> quit


4.从备份文件中copy良好数据块进行恢复
                                                          
[oracle@jumper conner]$ bbed parfile=par.bbd 
Password: 

BBED: Release 2.0.0.0.0 - Limited Production on Sun Sep 11 22:33:55 2005

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED> set file 4
        FILE#           4

BBED> show
        FILE#           4
        BLOCK#          1
        OFFSET          0
        DBA             0x01000001 (16777217 4,1)
        FILENAME        /opt/oracle/oradata/conner/users01.dbf.bak
        BIFILE          bifile.bbd
        LISTFILE        filelist.txt
        BLOCKSIZE       8192
        MODE            Edit
        EDIT            Unrecoverable
        IBASE           Dec
        OBASE           Dec
        WIDTH           80
        COUNT           512
        LOGFILE         log.bbd
        SPOOL           No

BBED> copy file 4 block 17 to file 3 block 17;
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) Y
 File: /opt/oracle/oradata/conner/users01.dbf (3)
 Block: 17               Offsets:    0 to  511           Dba:0x00c00011
------------------------------------------------------------------------
 06020000 1100c000 75b5a320 00000104 06300000 01000000 611e0000 72b5a320 
 00000000 03003201 0900c000 ffff0000 00000000 00000000 00000000 00800000 
 72b5a320 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00012600 
 ffff5e00 d5037703 77030000 2600c21e 101e581d a91cf61b 471b941a dd192819 
 6218b417 06175216 9715dd14 26146c13 b4120712 44118310 bc0ffa0e 380e790d 
 b60cf40b 350b790a c0090409 45088b07 cc060e06 57059804 d5030000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 <32 bytes per line>

BBED> verify
DBVERIFY - Verification starting
FILE = /opt/oracle/oradata/conner/users01.dbf
BLOCK = 17


DBVERIFY - Verification complete

Total Blocks Examined         : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0

BBED> 


至此恢复完成。
5.数据库验证

SQL> select count(*) from bbed;
select count(*) from bbed
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 3, block # 17)
ORA-01110: data file 3: '/opt/oracle/oradata/conner/users01.dbf'

SQL> alter tablespace users offline;

Tablespace altered.

SQL> alter tablespace users online;

Tablespace altered.

SQL> select count(*) from bbed;

  COUNT(*)
----------
       523

善用BBED可以从很多棘手的问题中拯救我们的数据库。本案例仅供参考。

历史上的今天...
    >> 2015-09-12文章:
    >> 2009-09-12文章:
    >> 2007-09-12文章:
           如何加快SMON的恢复进度?
    >> 2004-09-12文章:

By eygle on 2005-09-12 04:38 | Comments (7) | Internal | 429 |

7 Comments

看了eygle的这篇文章,感觉用这个工具只能是在恢复和备份之间的时间段没有对block做改变的情况下,如果备份后block又做了update……操作的话,用bbed也是没法恢复的。不知道理解的对不对,请指正。

还是有办法的,不过这个工具很危险,就不讨论那么多了。

正常情况下,做好备份,是用不到这些工具的。

Eygle,Help~~~~

我有个放数据库的raid突然坏了,数据总算copy出来了。但是启动数据库时,发生了错误:
ERROR at line 1:
ORA-00704: bootstrap process failure
ORA-00704: bootstrap process failure
ORA-00604: error occurred at recursive SQL level 1
ORA-01578: ORACLE data block corrupted (file # 1, block # 62)
ORA-01110: data file 1: 'D:\ORACLE\ORADATA\CWDO\SYSTEM01.DBF'
而且没有好的数据备份,怎么用BBED恢复呢?

万分感谢!

你这个有坏块了,BBED也可能搞不定的。

真是的这样,而且还坏了很多块。只能用ultraedit修改了:(

我在恢复完坏块之后,验证数据库,查询那张表时报如下错误:
ORA-08103: object no longer exists
不知道大家有没有遇到?后来是怎么解决的?

我在恢复完坏块之后,验证数据库那张表,查询时报如下错误:
ORA-08103: object no longer exists
大家有没有遇到过?是如何解决的?


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com