我是靠谱客的博主 文静鼠标,最近开发中收集的这篇文章主要介绍oracle11g dataguard failover重建后归档日志没有被应用被NO的问题,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

1。主库从库归档记录不一致。例如以下所看到的:

做完failover后,坏的旧主库变成了新的从库,可是新从库的归档日志记录不一致,就是archive log list;出来的和v$archived_log出来对不上号,例如以下所看到的:

1.1 主库:
SQL> archive log list;
Database log mode
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence
8
Next log sequence to archive
10
Current log sequence
10
SQL> 
SQL>
select sequence#,applied from v$archived_log order by sequence# asc;
......
---------- ---------
7527 YES
7527 YES
7528 YES
7528 YES
7529 YES
7530 YES
7531 YES
7532 YES
7533 YES
14529 rows selected.

大家能够看到主库中archive log list和v$archived_log记录归档不一致。

1.2 从库:

SQL> archive log list;
Database log mode
Archive Mode
Automatic archival
Enabled
Archive destination
USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence
10
Next log sequence to archive
0
Current log sequence
10
SQL> 
SQL> select sequence#,applied from v$archived_log order by sequence# asc;
SEQUENCE# APPLIED
---------- ---------
9 IN-MEMORY
SQL>

从库的归档也一直没有被应用,并且两者也查了一个数字差,一个为10。一个为9。

PS:大家看到主库和从库归档号没有统一起来,不一致。


2,清除新主库的归档记录

问题原因是在新主库上保留的还是旧主库的归档日志记录,须要手工清理一下,在新主库上运行清除记录:

SQL> execute sys.dbms_backup_restore.resetCfileSection(11);
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL>
select sequence#,applied from v$archived_log order by sequence# asc;
no rows selected
SQL> 

去归档日志文件夹。人为删除旧的归档日志

[oracle@oracle_standby1 archivelog]$ rm -rf 2015_12_13/ 2015_12_19 2015_12_20 2015_12_21 2015_12_22 2015_12_23 2015_12_24 2015_12_25
[oracle@oracle_standby1 archivelog]$ 

然后进入rman运行

RMAN> catalog db_recovery_file_dest;
RMAN> catalog db_recovery_file_dest;
using target database control file instead of recovery catalog
searching for all files in the recovery area
List of Files Unknown to the Database
=====================================
File Name: /oracle/app/oracle/flash_recovery_area/STANDBY/onlinelog/o1_mf_9_c7c1v5qw_.log
File Name: /oracle/app/oracle/flash_recovery_area/STANDBY/onlinelog/o1_mf_7_c7c1ttf1_.log
File Name: /oracle/app/oracle/flash_recovery_area/STANDBY/onlinelog/o1_mf_8_c7dst287_.log
File Name: /oracle/app/oracle/flash_recovery_area/STANDBY/onlinelog/o1_mf_7_c7dssvfd_.log
File Name: /oracle/app/oracle/flash_recovery_area/STANDBY/onlinelog/o1_mf_9_c7dst8wr_.log
File Name: /oracle/app/oracle/flash_recovery_area/STANDBY/onlinelog/o1_mf_8_c7c1v0ff_.log
File Name: /oracle/app/oracle/flash_recovery_area/STANDBY/archivelog/2015_12_26/o1_mf_1_9_c7wqvrp9_.arc
Do you really want to catalog the above files (enter YES or NO)?

YES cataloging files... cataloging done List of Cataloged Files ======================= File Name: /oracle/app/oracle/flash_recovery_area/STANDBY/archivelog/2015_12_26/o1_mf_1_9_c7wqvrp9_.arc List of Files Which Where Not Cataloged ======================================= File Name: /oracle/app/oracle/flash_recovery_area/STANDBY/onlinelog/o1_mf_9_c7c1v5qw_.log RMAN-07529: Reason: catalog is not supported for this file type File Name: /oracle/app/oracle/flash_recovery_area/STANDBY/onlinelog/o1_mf_7_c7c1ttf1_.log RMAN-07529: Reason: catalog is not supported for this file type File Name: /oracle/app/oracle/flash_recovery_area/STANDBY/onlinelog/o1_mf_8_c7dst287_.log RMAN-07529: Reason: catalog is not supported for this file type File Name: /oracle/app/oracle/flash_recovery_area/STANDBY/onlinelog/o1_mf_7_c7dssvfd_.log RMAN-07529: Reason: catalog is not supported for this file type File Name: /oracle/app/oracle/flash_recovery_area/STANDBY/onlinelog/o1_mf_9_c7dst8wr_.log RMAN-07529: Reason: catalog is not supported for this file type File Name: /oracle/app/oracle/flash_recovery_area/STANDBY/onlinelog/o1_mf_8_c7c1v0ff_.log RMAN-07529: Reason: catalog is not supported for this file type RMAN> exit

然后进入sql命令查看:

SQL>
select sequence#,applied from v$archived_log order by sequence# asc;
SEQUENCE# APPLIED
---------- ---------
9 NO
SQL> 

3,之后switch切换日志測试

主库:

SQL> alter system switch logfile;
System altered.
SQL>
select sequence#,applied from v$archived_log order by sequence# asc;
SEQUENCE# APPLIED
---------- ---------
9 NO
10 NO
10 NO
SQL> 

从库:

SQL> select sequence#,applied from v$archived_log order by sequence# asc;
SEQUENCE# APPLIED
---------- ---------
9 YES
10 YES
SQL> 

看到两边归档日志以及被应用情况都一致了。

最后

以上就是文静鼠标为你收集整理的oracle11g dataguard failover重建后归档日志没有被应用被NO的问题的全部内容,希望文章能够帮你解决oracle11g dataguard failover重建后归档日志没有被应用被NO的问题所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(41)

评论列表共有 0 条评论

立即
投稿
返回
顶部