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

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

 

  BLOG文档结构图

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


 

3.3  故障分析及解决过程

因为是DG环境,所以首先我们来恢复主库,然后再修复备库的文件问题。

SYS@oraLHRD1> select status from  v$datafile d WHERE d.FILE#=64;

 

STATUS

-------

OFFLINE

 

SYS@oraLHRD1> select file#,online_status,change#,ERROR from v$recover_file;

 

     FILE# ONLINE_    CHANGE# ERROR

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

        64 OFFLINE 1764555149

 

SYS@oraLHRD1> alter database datafile 64 online;

alter database datafile 64 online

*

ERROR at line 1:

ORA-01113: file 64 needs media recovery

ORA-01110: data file 64: '+DATA1/oralhrs/datafile/tbs101.262.876578481'

 

 

SYS@oraLHRD1> recover datafile 64;

ORA-00279: change 1764555149 generated at 03/27/2015 10:42:00 needed for thread 2

ORA-00289: suggestion : /arch/2_1128_868895513.arc

ORA-00280: change 1764555149 for thread 2 is in sequence #1128

 

 

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

AUTO

ORA-00308: cannot open archived log '/arch/2_1128_868895513.arc'

ORA-27037: unable to obtain file status

IBM AIX RISC System/6000 Error: 2: No such file or directory

Additional information: 3

 

 

ORA-00308: cannot open archived log '/arch/2_1128_868895513.arc'

ORA-27037: unable to obtain file status

IBM AIX RISC System/6000 Error: 2: No such file or directory

Additional information: 3

 

SYS@oraLHRD1> ! ls /arch/2_1128_868895513.arc

ls: 0653-341 The file /arch/2_1128_868895513.arc does not exist.

 

 

可以看到要恢复64号文件需要的是1128号归档日志,从之前的查询我们也知道日志最后一次访问是2015年4月21,而现在系统的归档号为1W多了:

SELECT * FROM v$log d WHERE d.STATUS='CURRENT' ORDER BY thread#;

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

SELECT a.FILE#, a.NAME,a.CHECKPOINT_CHANGE#,a.LAST_CHANGE#,status FROM v$datafile a;

SELECT a.FILE#,a.NAME,a.RECOVER,a.CHECKPOINT_CHANGE#,status  FROM v$datafile_header a; 

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

那目前是数据文件OFFLINE,而归档文件又丢失了,如果想把该文件ONLINE,我们必须采用BBED来推进数据文件的SCN号到最近的日志号才可以。有关该部分的理论知识可以参考: 【BBED】丢失归档文件情况下的数据文件的恢复:http://blog.itpub.net/26736162/viewspace-2079337/

这里我们依然采用BBED来修复该问题。

注意:由于我们的环境是DG环境,所以先把备库的监听器停掉,以免恢复的过程中,主库生成的日志传递到备库,而主库日志被删除后,修复该文件就又得往前推进了,所以先把备库的监听停掉,确保主库的日志不被删除。

[ZFLHRSDB4:root]:/>crsctl stat res -t

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

NAME           TARGET  STATE        SERVER                   STATE_DETAILS      

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

Local Resources

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

ora.LISTENER.lsnr

               ONLINE  ONLINE       zflhrsdb3                                   

               ONLINE  ONLINE       zflhrsdb4                                   

ora.LISTENER_DG.lsnr====>>>>> 这个是DG的监听器

               ONLINE  ONLINE       zflhrsdb3                                   

               ONLINE  ONLINE       zflhrsdb4                                   

ora.asm

               ONLINE  ONLINE       zflhrsdb3                Started            

               ONLINE  ONLINE       zflhrsdb4                Started            

ora.gsd

               OFFLINE OFFLINE      zflhrsdb3                                   

               OFFLINE OFFLINE      zflhrsdb4                                   

ora.net1.network

               ONLINE  ONLINE       zflhrsdb3                                   

               ONLINE  ONLINE       zflhrsdb4                                   

ora.ons

               ONLINE  ONLINE       zflhrsdb3                                   

               ONLINE  ONLINE       zflhrsdb4                                   

ora.registry.acfs

               ONLINE  ONLINE       zflhrsdb3                                   

               ONLINE  ONLINE       zflhrsdb4                                   

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

Cluster Resources

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

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE       zflhrsdb4                                   

ora.cvu

      1        ONLINE  ONLINE       zflhrsdb4                                   

ora.oc4j

      1        ONLINE  ONLINE       zflhrsdb4                                   

ora.oralhrsg.db

      1        ONLINE  ONLINE       zflhrsdb3                Open,Readonly      

      2        ONLINE  ONLINE       zflhrsdb4                Open,Readonly      

ora.scan1.vip

      1        ONLINE  ONLINE       zflhrsdb4                                   

ora.zflhrsdb3.vip

      1        ONLINE  ONLINE       zflhrsdb3                                   

ora.zflhrsdb4.vip

      1        ONLINE  ONLINE       zflhrsdb4                                   

[ZFLHRSDB4:root]:/>

[ZFLHRSDB4:root]:/>

[ZFLHRSDB4:root]:/>

[ZFLHRSDB4:root]:/>

[ZFLHRSDB4:root]:/>crsctl stop res ora.LISTENER_DG.lsnr

CRS-2673: Attempting to stop 'ora.LISTENER_DG.lsnr' on 'zflhrsdb4'

CRS-2673: Attempting to stop 'ora.LISTENER_DG.lsnr' on 'zflhrsdb3'

CRS-2677: Stop of 'ora.LISTENER_DG.lsnr' on 'zflhrsdb4' succeeded

CRS-2677: Stop of 'ora.LISTENER_DG.lsnr' on 'zflhrsdb3' succeeded

[ZFLHRSDB4:root]:/>

 

接下来就可以做恢复操作了。

 

3.3.1  修复主库的OFFLINE文件

首先,64号文件当前的SCN号1764555149,我们需要将其修改为15760391176,而日志号也需要转换为11087号,这些都需要转换为十六进制,如下:

SYS@oraLHRD2> SELECT TO_CHAR(1764555149, 'xxxxxxxxxxxx') CUR_SCN,

  2         TO_CHAR(15760391176, 'xxxxxxxxxxxx') TARGET_SCN,

  3         TO_CHAR(11087, 'xxxxxxxxxxxx') TARGET_SEQ

  4    FROM DUAL;

 

CUR_SCN       TARGET_SCN    TARGET_SEQ

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

    692cf98d     3ab647c08          3275

692cf98d和后边BBED查询出来的数据文件头的结果一致。

 
一、 BBED修改文件头推进SCN号
 
1、 编译BBED

首先准备BBED的环境,编译BBED,将以下4个文件拷贝到Oracle的相关的目录:

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

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

注意:文件我已上传到云盘,可以去http://blog.itpub.net/26736162/viewspace-1624453/下载。

接下来我们编译BBED:

[ZFLHRSDB1:oracle]:/oracle>ls -l  $ORACLE_HOME/rdbms/lib/*sbbd*

-rw-r--r--    1 root     system         1671 May 26 2010  /oracle/app/oracle/product/11.2.0/db/rdbms/lib/sbbdpt.o

-rw-r--r--    1 root     system          900 May 26 2010  /oracle/app/oracle/product/11.2.0/db/rdbms/lib/ssbbded.o

[ZFLHRSDB1:oracle]:/oracle>ls -l  $ORACLE_HOME/rdbms/mesg/bbed*

-rw-r--r--    1 root     system         8704 May 27 2010  /oracle/app/oracle/product/11.2.0/db/rdbms/mesg/bbedus.msb

-rw-r--r--    1 root     system        10270 Jul 25 2000  /oracle/app/oracle/product/11.2.0/db/rdbms/mesg/bbedus.msg

[ZFLHRSDB1:oracle]:/oracle>exit

You have mail in /usr/spool/mail/root

[ZFLHRSDB1:root]:/>chown oracle:dba /oracle/app/oracle/product/11.2.0/db/rdbms/lib/sbbdpt.o

[ZFLHRSDB1:root]:/>chown oracle:dba /oracle/app/oracle/product/11.2.0/db/rdbms/lib/ssbbded.o

[ZFLHRSDB1:root]:/>chown oracle:dba /oracle/app/oracle/product/11.2.0/db/rdbms/mesg/bbedus.msb

[ZFLHRSDB1:root]:/>chown oracle:dba /oracle/app/oracle/product/11.2.0/db/rdbms/mesg/bbedus.msg

[ZFLHRSDB1:root]:/>su - oracle

[ZFLHRSDB1:oracle]:/oracle>make -f              ORACLEHOME/rdbms/lib/insrdbms.mkBBED=              ORACLE_HOME/bin/bbed$ORACLE_HOME/bin/bbed

 

Linking BBED utility (bbed)

        rm -f /oracle/app/oracle/product/11.2.0/db/bin/bbed

        ld -b64 -o /oracle/app/oracle/product/11.2.0/db/bin/bbed -L/oracle/app/oracle/product/11.2.0/db/rdbms/lib/ -L/oracle/app/oracle/product/11.2.0/db/lib/ /oracle/app/oracle/product/11.2.0/db/lib/s0main.o /oracle/app/oracle/product/11.2.0/db/rdbms/lib/ssbbded.o /oracle/app/oracle/product/11.2.0/db/rdbms/lib/sbbdpt.o -bI:/usr/lib/aio.exp `cat /oracle/app/oracle/product/11.2.0/db/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11   -ldbtools11  `cat /oracle/app/oracle/product/11.2.0/db/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /oracle/app/oracle/product/11.2.0/db/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11 -lztkg11 -lztkg11 -lclient11 -lnnetd11  -lvsn11  -lcommon11 -lgeneric11 -lmm -lsnls11 -lnls11  -lcore11 -lsnls11  -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11  -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `cat /oracle/app/oracle/product/11.2.0/db/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /oracle/app/oracle/product/11.2.0/db/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lclient11 -lnnetd11  -lvsn11  -lcommon11 -lgeneric11 -lpls11  -lrt  -lsnls11 -lnls11  -lcore11 -lsnls11  -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11  -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11  -lclient11 -lnnetd11  -lvsn11  -lcommon11 -lgeneric11 -lsnls11 -lnls11  -lcore11 -lsnls11  -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11  -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11  -lld -lm `cat /oracle/app/oracle/product/11.2.0/db/lib/sysliblist`  -lm   -lsql11  /oracle/app/oracle/product/11.2.0/db/lib/nautab.o /oracle/app/oracle/product/11.2.0/db/lib/naeet.o /oracle/app/oracle/product/11.2.0/db/lib/naect.o /oracle/app/oracle/product/11.2.0/db/lib/naedhs.o

ld: 0711-224 WARNING: Duplicate symbol: .aio_nwait_timeout64

ld: 0711-224 WARNING: Duplicate symbol: aio_nwait_timeout64

ld: 0711-224 WARNING: Duplicate symbol: .aio_nwait64

ld: 0711-224 WARNING: Duplicate symbol: aio_nwait64

ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

ld: 0711-773 WARNING: Object /oracle/app/oracle/product/11.2.0/db/lib//libgeneric11.a[sdbgrfu.o], imported symbol timezone

        Symbol was expected to be local. Extra instructions

        are being generated to reference the symbol.


上一篇:【DG】 基于同一个主机建立物理备库和逻辑备库(二)


下一篇:【DB笔试面试752】在Oracle中,搭建物理DG需要注意的地方有哪些?