ITPub博客

首页 > Linux操作系统 > Linux操作系统 > bbed实验三 corrupted块恢复

bbed实验三 corrupted块恢复

原创 Linux操作系统 作者:v_fantasy 时间:2009-04-03 23:24:03 0 删除 编辑

HHL-690-1:/oracle/bbed$bbed parfile=par.bbd
Password:

BBED: Release 2.0.0.0.0 - Limited Production on Fri Apr 3 23:50:12 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

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

BBED> set file 2
        FILE#           2

BBED> set block 61
        BLOCK#          61

BBED> map /v
 File: /dev/rzz_01_lv (2)
 Block: 61                                    Dba:0x0080003d
------------------------------------------------------------
 KTB Data Block (Table/Cluster)

 struct kcbh, 20 bytes                      @0      
    ub1 type_kcbh                           @0      
    ub1 frmt_kcbh                           @1      
    ub1 spare1_kcbh                         @2      
    ub1 spare2_kcbh                         @3      
    ub4 rdba_kcbh                           @4      
    ub4 bas_kcbh                            @8      
    ub2 wrp_kcbh                            @12     
    ub1 seq_kcbh                            @14     
    ub1 flg_kcbh                            @15     
    ub2 chkval_kcbh                         @16     
    ub2 spare3_kcbh                         @18     

 struct ktbbh, 72 bytes                     @20     
    ub1 ktbbhtyp                            @20     
    union ktbbhsid, 4 bytes                 @24     
    struct ktbbhcsc, 8 bytes                @28     
    b2 ktbbhict                             @36     
    ub1 ktbbhflg                            @38     
    ub1 ktbbhfsl                            @39     
    ub4 ktbbhfnx                            @40     
    struct ktbbhitl[2], 48 bytes            @44     

 struct kdbh, 14 bytes                      @100    
    ub1 kdbhflag                            @100    
    b1 kdbhntab                             @101    
    b2 kdbhnrow                             @102    
    sb2 kdbhfrre                            @104    
    sb2 kdbhfsbo                            @106    
    sb2 kdbhfseo                            @108    
    b2 kdbhavsp                             @110    
    b2 kdbhtosp                             @112    

 struct kdbt[1], 4 bytes                    @114    
    b2 kdbtoffs                             @114    
    b2 kdbtnrow                             @116    

 sb2 kdbr[3]                                @118    

 ub1 freespace[8025]                        @124    

 ub1 rowdata[39]                            @8149   

 ub4 tailchk                                @8188   


BBED> p kcbh
struct kcbh, 20 bytes                       @0      
   ub1 type_kcbh                            @0        0x06
   ub1 frmt_kcbh                            @1        0xa2
   ub1 spare1_kcbh                          @2        0x00
   ub1 spare2_kcbh                          @3        0x00
   ub4 rdba_kcbh                            @4        0x0100003d
   ub4 bas_kcbh                             @8        0x06e07699
   ub2 wrp_kcbh                             @12       0x09c3
   ub1 seq_kcbh                             @14       0xff
   ub1 flg_kcbh                             @15       0x06 (KCBHFDLC, KCBHFCKV)
   ub2 chkval_kcbh                          @16       0xd9e7
   ub2 spare3_kcbh                          @18       0x0000

SQL> select * from test;
select * from test
              *
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 4, block # 61)
ORA-01110: data file 4: '/dev/rzz_01_lv'

 

下面进行恢复

HHL-690-1:/oracle/bbed$bbed parfile=par.bbd
Password:

BBED: Release 2.0.0.0.0 - Limited Production on Fri Apr 3 23:54:23 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

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

BBED> set file 2
        FILE#           2

BBED> set block 61
        BLOCK#          61

BBED> map /v
 File: /dev/rzz_01_lv (2)
 Block: 61                                    Dba:0x0080003d
------------------------------------------------------------
 KTB Data Block (Table/Cluster)

 struct kcbh, 20 bytes                      @0      
    ub1 type_kcbh                           @0      
    ub1 frmt_kcbh                           @1      
    ub1 spare1_kcbh                         @2      
    ub1 spare2_kcbh                         @3      
    ub4 rdba_kcbh                           @4      
    ub4 bas_kcbh                            @8      
    ub2 wrp_kcbh                            @12     
    ub1 seq_kcbh                            @14     
    ub1 flg_kcbh                            @15     
    ub2 chkval_kcbh                         @16     
    ub2 spare3_kcbh                         @18     

 struct ktbbh, 72 bytes                     @20     
    ub1 ktbbhtyp                            @20     
    union ktbbhsid, 4 bytes                 @24     
    struct ktbbhcsc, 8 bytes                @28     
    b2 ktbbhict                             @36     
    ub1 ktbbhflg                            @38     
    ub1 ktbbhfsl                            @39     
    ub4 ktbbhfnx                            @40     
    struct ktbbhitl[2], 48 bytes            @44     

 struct kdbh, 14 bytes                      @100    
    ub1 kdbhflag                            @100    
    b1 kdbhntab                             @101    
    b2 kdbhnrow                             @102    
    sb2 kdbhfrre                            @104    
    sb2 kdbhfsbo                            @106    
    sb2 kdbhfseo                            @108    
    b2 kdbhavsp                             @110    
    b2 kdbhtosp                             @112    

 struct kdbt[1], 4 bytes                    @114    
    b2 kdbtoffs                             @114    
    b2 kdbtnrow                             @116    

 sb2 kdbr[3]                                @118    

 ub1 freespace[8025]                        @124    

 ub1 rowdata[39]                            @8149   

 ub4 tailchk                                @8188   


BBED> p kcbh
struct kcbh, 20 bytes                       @0      
   ub1 type_kcbh                            @0        0x06
   ub1 frmt_kcbh                            @1        0xa2
   ub1 spare1_kcbh                          @2        0x00
   ub1 spare2_kcbh                          @3        0x00
   ub4 rdba_kcbh                            @4        0x0100003d
   ub4 bas_kcbh                             @8        0x06e07699
   ub2 wrp_kcbh                             @12       0x09c3
   ub1 seq_kcbh                             @14       0xff
   ub1 flg_kcbh                             @15       0x06 (KCBHFDLC, KCBHFCKV)
   ub2 chkval_kcbh                          @16       0xd9e7
   ub2 spare3_kcbh                          @18       0x0000

BBED> dump /v offset 14
 File: /dev/rzz_01_lv (2)
 Block: 61      Offsets:   14 to  525  Dba:0x0080003d
-------------------------------------------------------
 ff06d9e7 00000100 00000000 cb3b06e0 l .............;..
 769809c3 df400002 32000100 0039000a l v....@..2....9..
 00240000 02e40080 03510160 13008000 l .$.......Q.`....
 09c306e0 71490004 00220000 014e0080 l ....qI..."...N..
 011a00e2 2c002001 000c06e0 76990000 l ....,. .....v...
 00000000 00000001 0003ffff 00181f71 l ...............q
 1f591f67 00000003 1f8a1f7e 1f710000 l .Y.g.......~.q..
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................
 00000000 00000000 00000000 00000000 l ................

 <16 bytes per line>

BBED> modify /x 01 offset 14
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
 File: /dev/rzz_01_lv (2)
 Block: 61               Offsets:   14 to  525           Dba:0x0080003d
------------------------------------------------------------------------
 0106d9e7 00000100 00000000 cb3b06e0 769809c3 df400002 32000100 0039000a
 00240000 02e40080 03510160 13008000 09c306e0 71490004 00220000 014e0080
 011a00e2 2c002001 000c06e0 76990000 00000000 00000001 0003ffff 00181f71
 1f591f67 00000003 1f8a1f7e 1f710000 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 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> map /v
 File: /dev/rzz_01_lv (2)
 Block: 61                                    Dba:0x0080003d
------------------------------------------------------------
 KTB Data Block (Table/Cluster)

 struct kcbh, 20 bytes                      @0      
    ub1 type_kcbh                           @0      
    ub1 frmt_kcbh                           @1      
    ub1 spare1_kcbh                         @2      
    ub1 spare2_kcbh                         @3      
    ub4 rdba_kcbh                           @4      
    ub4 bas_kcbh                            @8      
    ub2 wrp_kcbh                            @12     
    ub1 seq_kcbh                            @14     
    ub1 flg_kcbh                            @15     
    ub2 chkval_kcbh                         @16     
    ub2 spare3_kcbh                         @18     

 struct ktbbh, 72 bytes                     @20     
    ub1 ktbbhtyp                            @20     
    union ktbbhsid, 4 bytes                 @24     
    struct ktbbhcsc, 8 bytes                @28     
    b2 ktbbhict                             @36     
    ub1 ktbbhflg                            @38     
    ub1 ktbbhfsl                            @39     
    ub4 ktbbhfnx                            @40     
    struct ktbbhitl[2], 48 bytes            @44     

 struct kdbh, 14 bytes                      @100    
    ub1 kdbhflag                            @100    
    b1 kdbhntab                             @101    
    b2 kdbhnrow                             @102    
    sb2 kdbhfrre                            @104    
    sb2 kdbhfsbo                            @106    
    sb2 kdbhfseo                            @108    
    b2 kdbhavsp                             @110    
    b2 kdbhtosp                             @112    

 struct kdbt[1], 4 bytes                    @114    
    b2 kdbtoffs                             @114    
    b2 kdbtnrow                             @116    

 sb2 kdbr[3]                                @118    

 ub1 freespace[8025]                        @124    

 ub1 rowdata[39]                            @8149   

 ub4 tailchk                                @8188   


BBED> p tailchk
ub4 tailchk                                 @8188     0x76990602

BBED> p kcbh
struct kcbh, 20 bytes                       @0      
   ub1 type_kcbh                            @0        0x06
   ub1 frmt_kcbh                            @1        0xa2
   ub1 spare1_kcbh                          @2        0x00
   ub1 spare2_kcbh                          @3        0x00
   ub4 rdba_kcbh                            @4        0x0100003d
   ub4 bas_kcbh                             @8        0x06e07699
   ub2 wrp_kcbh                             @12       0x09c3
   ub1 seq_kcbh                             @14       0x01
   ub1 flg_kcbh                             @15       0x06 (KCBHFDLC, KCBHFCKV)
   ub2 chkval_kcbh                          @16       0xd9e7
   ub2 spare3_kcbh                          @18       0x0000

BBED> dump /v 8188
BBED-00202: invalid parameter (8188)


BBED> dump /v offset 8188
 File: /dev/rzz_01_lv (2)
 Block: 61      Offsets: 8188 to 8191  Dba:0x0080003d
-------------------------------------------------------
 76990602                            l v...

 <16 bytes per line>

BBED> modify /x 01 offset 8191
 File: /dev/rzz_01_lv (2)
 Block: 61               Offsets: 8191 to 8191           Dba:0x0080003d
------------------------------------------------------------------------
 01

 <32 bytes per line>

BBED> sum apply
Check value for File 2, Block 61:
current = 0x27e4, required = 0x27e4

下面测试是否恢复成功

select * from test
              *
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 4, block # 61)
ORA-01110: data file 4: '/dev/rzz_01_lv'


SQL> alter system flush buffer_cache;

System altered.

SQL> select * from test;

         A B
---------- ----------
         1 ysatnaf
         2 daily
         3 lovely

由于corrupt块是我自己造出来的,开始没有修改tailchk,所以恢复的时候tailchk的最后两位不是ff。


 

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

请登录后发表评论 登录
全部评论

注册时间:2008-10-07

  • 博文量
    98
  • 访问量
    179461