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> 

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

你可能感兴趣的:(oracle,11g)