NetData

国际知名打杂人士!!!

  • 博客访问: 145614
  • 博文数量: 103
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-29 20:54
  • 认证徽章:
个人简介

一名技术打杂者的漂泊生涯……

ITPUB论坛APP

ITPUB论坛APP



APP发帖 享双倍积分

文章分类

全部博文(103)

文章存档

2017年(40)

2016年(11)

2015年(52)

微信关注

IT168企业级官微



微信号:IT168qiye



系统架构师大会



微信号:SACC2013

订阅
热词专题

分类: Oracle

dataguard 由于主库参数未配置归档删除策略导致库归档丢失
今天巡检库时候发现备库未启动,监控agent也被人关闭了,手动启动
按照日志惯例打开备库(read_only),但是在open的过程中显示以下错误

点击(此处)折叠或打开

  1. Standby crash recovery failed to bring standby database to a consistent
  2. point because needed redo hasn't arrived yet.
  3. MRP: Wait timeout: thread 1 sequence# 173
  4. Standby Crash Recovery aborted due to error 16016.
  5. Errors in file /u01/app/oracle/diag/rdbms/orcl_st1/orcl/trace/orcl_ora_29639.trc:
  6. ORA-16016: archived log for thread 1 sequence# 173 unavailable
  7. Recovery interrupted!
  8. Some recovered datafiles maybe left media fuzzy
  9. Media recovery may continue but open resetlogs may fail
  10. Completed Standby Crash Recovery.
  11. Errors in file /u01/app/oracle/diag/rdbms/orcl_st1/orcl/trace/orcl_ora_29639.trc:
  12. ORA-10458: standby database requires recovery
  13. ORA-01196: file 1 is inconsistent due to a failed media recovery session
  14. ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'
  15. ORA-10458 signalled during: alter database open...


但是手动应用归档显示已经应用完成,后台查日志备库应用到sequence 173而主库已经应用到214,查看归档目录下,发现归档已经丢失了,由于备机关机未启动导致归档未传送过来.
我们在主库中恢复归档

点击(此处)折叠或打开

  1. rman target /
  2. restore archivelog from sequence 173


将恢复出来的日志拷贝到备库
手动注册丢失的归档,这里我用脚本批量处理的;

点击(此处)折叠或打开

  1. for i in `seq 173 214`;do echo "ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_"$i"_956999399.dbf;'";done
173-214为丢失归档的范围

点击(此处)折叠或打开

  1. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_173_956999399.dbf';
  2. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_174_956999399.dbf';
  3. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_175_956999399.dbf';
  4. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_176_956999399.dbf';
  5. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_177_956999399.dbf';
  6. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_178_956999399.dbf';
  7. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_179_956999399.dbf';
  8. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_180_956999399.dbf';
  9. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_181_956999399.dbf';
  10. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_182_956999399.dbf';
  11. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_183_956999399.dbf';
  12. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_184_956999399.dbf';
  13. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_185_956999399.dbf';
  14. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_186_956999399.dbf';
  15. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_187_956999399.dbf';
  16. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_188_956999399.dbf';
  17. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_189_956999399.dbf';
  18. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_190_956999399.dbf';
  19. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_191_956999399.dbf';
  20. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_192_956999399.dbf';
  21. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_193_956999399.dbf';
  22. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_194_956999399.dbf';
  23. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_195_956999399.dbf';
  24. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_196_956999399.dbf';
  25. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_197_956999399.dbf';
  26. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_198_956999399.dbf';
  27. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_199_956999399.dbf';
  28. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_200_956999399.dbf';
  29. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_201_956999399.dbf';
  30. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_202_956999399.dbf';
  31. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_203_956999399.dbf';
  32. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_204_956999399.dbf';
  33. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_205_956999399.dbf';
  34. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_206_956999399.dbf';
  35. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_207_956999399.dbf';
  36. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_208_956999399.dbf';
  37. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_209_956999399.dbf';
  38. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_210_956999399.dbf';
  39. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_211_956999399.dbf';
  40. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_212_956999399.dbf';
  41. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_213_956999399.dbf';
  42. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_214_956999399.dbf';

点击(此处)折叠或打开

  1. SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;


注:如果归档量比较多可以指定并行度

点击(此处)折叠或打开

  1. ALTER DATABASE RECOVER MANAGED STANDBY DATABASE PARALLEL 2 DISCONNECT FROM SESSION;
  2. ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
数据库可正常open

点击(此处)折叠或打开

  1. SQL> ALTER DATABASE OPEN;
  2. SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
最后设置一下主库归档删除策略
主库操作

点击(此处)折叠或打开

  1. rman target /
  2. CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
如果出现以下错误

点击(此处)折叠或打开

  1. CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
  2. new RMAN configuration parameters:
  3. CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
  4. new RMAN configuration parameters are successfully stored
  5. RMAN-08591: WARNING: invalid archivelog deletion policy
需要修改修改数据库参数,重启库,然后重新 设置归档删除策略

点击(此处)折叠或打开

  1. SQL>alter system set "_log_deletion_policy"=ALL scope=spfile sid='*';

阅读(519) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册