程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle教程 >> oracle11gdataguardfailover重建後歸檔日志沒有被應用被NO的問題

oracle11gdataguardfailover重建後歸檔日志沒有被應用被NO的問題

編輯:Oracle教程

oracle11gdataguardfailover重建後歸檔日志沒有被應用被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> 

看到兩邊歸檔日志以及被應用情況都一致了。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved