日期:2014-05-16  浏览次数:20730 次

DG日志不应用,GAP,主备切换解决思路与办法
环境ORACLE 10G OS WINDOWS

对于DG故障解决思路,DG日志切换不进行应用,DG出现GAP解决方法,DG主备库切换,

当DG出现故障时,第一时间检测alert日志,服务器OS日志,网络是否通畅。

1、当DG出现日志不能传输到备库
   一、TNS配置错误,监听配置错误。
   二、主备库初始化参数文件配置错误(如archive_log_dest文件位置错误)。
   三、备库控制文件过旧,从主库生成一个STANDBY CONTROL过去。 
       SQL> alter database create standby controlfile as 'c:\control01.ctl';。
   四、备库是否应用了Failovers 。 
               
下面模拟备库应用了Failovers 。
备库执行
SQL>  alter database recover managed standby database finish; 

Database altered.

备库:

SQL> select PROTECTION_MODE,OPEN_MODE,DB_UNIQUE_NAME,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;


PROTECTION_MODE      OPEN_MODE            DB_UNIQUE_NAME                 DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- -------------------- ------------------------------ ---------------- --------------------
MAXIMUM PERFORMANCE  READ ONLY            PRIMARY                        PHYSICAL STANDBY TO PRIMARY      


主库:

SQL> select PROTECTION_MODE,OPEN_MODE,DB_UNIQUE_NAME,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;

PROTECTION_MODE      OPEN_MODE            DB_UNIQUE_NAME                 DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- -------------------- ------------------------------ ---------------- --------------------
MAXIMUM PERFORMANCE  READ WRITE           STANDBY                          PRIMARY          SESSIONS ACTIVE

主库alert文件:

ARC1: All Archive destinations made inactive due to error 394
ARC1: Failed to archive thread 1 sequence 1 (394)
ARCH: Archival stopped, error occurred. Will continue retrying
Wed Oct 30 10:25:54 2013
Errors in file c:\oracle\product\10.2.0\admin\orcl\bdump\orcl_arc1_1236.trc:
ORA-16038: log 2 sequence# 1 cannot be archived
ORA-00394: online log reused while attempting to archive it
ORA-00312: online log 2 thread 1: 'C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\STANDBY\ONLINELOG\O1_MF_2_96YY5JSW_.LOG'


ARC1: All Archive destinations made inactive due to error 394
*** 2013-10-30 10:25:54.796 58942 kcrr.c
kcrrfail: dest:1 err:394 force:0 blast:1
*** 2013-10-30 10:25:54.828 20146 kcrr.c
ORA-16038: log 2 sequence# 1 cannot be archived
ORA-00394: online log reused while attempting to archive it
ORA-00312: online log 2 thread 1: 'C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\STANDBY\ONLINELOG\O1_MF_2_96YY5JSW_.LOG'
*** 2013-10-30 10:27:54.734
*** 2013-10-30 10:27:54.734 20146 kcrr.c
*** 2013-10-30 10:28:54.765
kcrrwkx: work to do 0x1 (start)
*** 2013-10-30 10:28:54.781 20146 kcrr.c

这个时候导致主库不再向备库传送日志了,我们只需要重建STANDBY控制文件就行

SQL> alter database create standby controlfile as 'c:\control01.ctl';。

其中当真正主库出现故障的Failovers的时候

一.查看是否有日志GAP,没有应用的日志: -
    SQL> SELECT UNIQUE THREAD#, MAX(SEQUENCE#) OVER(PARTITION BY THREAD#) LAST FROM V$ARCHIVED_LOG; 
  SQL> SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP; 
  如果有,则拷贝过来并且注册 
    SQL> ALTER DATA