【故障处理】DG环境主库丢失归档情况下数据文件的恢复            

 

BLOG文档结构图

 
2、 修复文件头的scn号

编译完成后可以使用BBED了:

SYS@oraLHRD1> set line 9999 pagesize 9999

SYS@oraLHRD1> col name format a80

SYS@oraLHRD1> select file#||' '||name||' '||bytes name from v$datafile where file#=64;

 

NAME

--------------------------------------------------------------------------------

64 +DATA1/oralhrs/datafile/tbs101.262.876578481 104857600

[ZFLHRSDB1:root]:/>su - grid

[ZFLHRSDB1:grid]:/home/grid>asmcmd

ASMCMD> cp +DATA1/oralhrs/datafile/tbs101.262.876578481 /tmp/a.dbf

copying +DATA1/oralhrs/datafile/tbs101.262.876578481 -> /tmp/a.dbf

ASMCMD> exit

[ZFLHRSDB1:grid]:/home/grid>exit

[ZFLHRSDB1:root]:/>su - oracle

[ZFLHRSDB1:oracle]:/oracle>vi /tmp/file.txt

[ZFLHRSDB1:oracle]:/oracle>cat /tmp/file.txt

1 /tmp/a.dbf

[ZFLHRSDB1:oracle]:/oracle>bbed PASSWORD=blockedit  mode=edit blocksize=8192 listfile=/tmp/file.txt

BBED-00303: unable to open file '/tmp/a.dbf'

 

[ZFLHRSDB1:oracle]:/oracle>l /tmp/a.dbf

-rw-r-----    1 grid     dba       104865792 Sep 20 17:07 /tmp/a.dbf

[ZFLHRSDB1:oracle]:/oracle>exit

[ZFLHRSDB1:root]:/>chown oracle.dba /tmp/a.dbf

[ZFLHRSDB1:root]:/>su - oracle

[ZFLHRSDB1:oracle]:/oracle>bbed PASSWORD=blockedit  mode=edit blocksize=8192 listfile=/tmp/file.txt

BBED-00303: unable to open file 'log.bbd'

 

[ZFLHRSDB1:oracle]:/oracle>cd /tmp

[ZFLHRSDB1:oracle]:/tmp>bbed PASSWORD=blockedit  mode=edit blocksize=8192 listfile=/tmp/file.txt

 

BBED: Release 2.0.0.0.0 - Limited Production on Tue Sep 20 17:11:28 2016

 

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

 

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

 

BBED> info

File#  Name                                                        Size(blks)

-----  ----                                                        ----------

     1  /tmp/a.dbf                                                           0

 

BBED> show

        FILE#           1

        BLOCK#          1

        OFFSET          0

        DBA             0x00400001 (4194305 1,1)

        FILENAME        /tmp/a.dbf

        BIFILE          bifile.bbd

        LISTFILE        /tmp/file.txt

        BLOCKSIZE       8192

        MODE            Edit

        EDIT            Unrecoverable

        IBASE           Dec

        OBASE           Dec

        WIDTH           80

        COUNT           512

        LOGFILE         log.bbd

        SPOOL           No

 

BBED> p kcvfhckp

struct kcvfhckp, 160 bytes                  @484    

   struct kcvcpscn, 8 bytes                 @484

     ====>>>>>kscnbas,这里是64号文件的当前SCN号,和之前查询来的是一致的,十进制为:1764555149

      ub4 kscnbas                           @484      0x692cf98d

      ub2 kscnwrp                           @488      0x0000

   ub4 kcvcptim                             @492      0x342e3478

   ub2 kcvcpthr                             @496      0x0002

   union u, 12 bytes                        @500    

      struct kcvcprba, 12 bytes             @500  

 ====>>>>>kcrbaseq,这里是64号文件的当前日志号,468转换为十进制是1128

         ub4 kcrbaseq                       @500      0x00000468

         ub4 kcrbabno                       @504      0x0002c2fe

         ub2 kcrbabof                       @508      0x0010

   ub1 kcvcpetb[0]                          @512      0x06

   ub1 kcvcpetb[1]                          @513      0x00

   ub1 kcvcpetb[2]                          @514      0x00

 

《《《《。。。。。。。。篇幅原因,有省略。。。。。。。。》》》》

 

====》数据文件的scn被记录在文件1号block偏移量484字节开始的四个字节中

 

BBED> d /v dba 1,1 offset 484 count 64

File: /tmp/a.dbf (1)

Block: 1       Offsets:  484 to  547  Dba:0x00400001

-------------------------------------------------------

 692cf98d 00000000 342e3478 00020000 l i,......4.4x....

00000468 0002c2fe 00100001 06000000 l ...h............

00000000 00000000 00000000 00000000 l ................

00000000 00000000 00000000 00000000 l ................

 

<16 bytes per line>

 

====》AIX下存储是正序,这个和linux正好相反

BBED> modify /x 3ab645ab3 dba 1,1 offset 484

BBED-00209: invalid number (3ab645ab3)

 

BBED> modify /x ab647c08 dba 1,1 offset 484

BBED-00209: invalid number (ab647c08)

====》484号不能直接修改,因为ab647c08是以字母开头,必须以数字开头,那么我们从483号开始修改

BBED> modify /x 00ab647c dba 1,1 offset 483

File: /tmp/a.dbf (1)

Block: 1                Offsets:  483 to  546           Dba:0x00400001

------------------------------------------------------------------------

00ab647c 7b000300 00342e34 78000200 0000002b 4f0002c2 fe000000 10060000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 

<32 bytes per line>

 

BBED>  modify /x  08 dba 1,1 offset 487

File: /tmp/a.dbf (1)

Block: 1                Offsets:  487 to  550           Dba:0x00400001

------------------------------------------------------------------------

08000300 00342e34 78000200 0000002b 4f0002c2 fe000000 10060000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 

<32 bytes per line>

 

BBED>  d /v dba 1,1 offset 484 count 64

File: /tmp/a.dbf (1)

Block: 1       Offsets:  484 to  547  Dba:0x00400001

-------------------------------------------------------

ab647c08 00030000 342e3478 00020000 l .d|.....4.4x....

00002b4f 0002c2fe 00000010 06000000 l ..+O............

00000000 00000000 00000000 00000000 l ................

00000000 00000000 00000000 00000000 l ................

 

<16 bytes per line>

 

BBED>

 

BBED> p kcvfhckp

struct kcvfhckp, 160 bytes                  @484    

   struct kcvcpscn, 8 bytes                 @484    

      ub4 kscnbas                           @484      0xab647c08

      ub2 kscnwrp                           @488      0x0003 ====>>>日志号过大,所以用到了kscnwrp

   ub4 kcvcptim                             @492      0x342e3478

   ub2 kcvcpthr                             @496      0x0002

   union u, 12 bytes                        @500    

      struct kcvcprba, 12 bytes             @500    

         ub4 kcrbaseq                       @500      0x00002b4f

         ub4 kcrbabno                       @504      0x0002c2fe

         ub2 kcrbabof                       @508      0x0000

   ub1 kcvcpetb[0]                          @512      0x06

   ub1 kcvcpetb[1]                          @513      0x00

 

 

BBED> sum apply

Check value for File 1, Block 1:

current = 0xcb25, required = 0xcb25


©著作权归作者所有:来自51CTO博客作者小麦苗DB宝的原创作品,如需转载,请注明出处,否则将追究法律责任

更多相关文章

  1. 单个logstash文件收集多个filebeat日志
  2. 【Tomcat】Tomcat的使用
  3. 使用NID修改DBID和DBNAME实验
  4. dd命令详解
  5. ***组织“海莲花”再活跃 打造全新macOS后门
  6. 一步一步搭建11gR2 rac+dg之配置单实例的DG(八)
  7. ORA-00600: [keltnfy-ldmInit], [46], [1], [], [], [], [], []
  8. 【BBED】 SYSTEM文件头损坏的恢复(4)
  9. 【等待事件】日志类 等待事件(4.1)--log file switch(日志文件切换)

随机推荐

  1. Android(监听+回调=观察者)模式从Dialog到A
  2. [置顶] android加密解密算法之3DE
  3. Android 中文件类型与MIME的匹配表
  4. 实战Andriod开发环境部署
  5. Android Studio 项目的导入以及依赖
  6. Material Design控件使用详解
  7. android OSChina 客户端源代码剖析
  8. android通知适用于循环中的一个对象[重复
  9. Android Support Design Library之TabLay
  10. 有没有方法在不root手机的情况下读取Data