DG_Check检测

DG_Check检测

1) all 查询备库角色(确认主备关系)
set linesize 140
col dbid for 9999999999
col name for a10
col database_role for a22
col open_mode for a10
col flashback_on for a5
select dbid,name, database_role,open_mode,FLASHBACK_ON,PROTECTION_MODE,FORCE_LOGGING from v$database;

2)备库查询DG延迟(如果备库开启实施应用应该为1分钟内,正常。如果差距10多个小时,可能存在情况需要排查)
set linesize 300
col name for a20
col value for a20
col time_computed for a30
select name,value,unit,time_computed from v$dataguard_stats where name in ('transport lag','apply lag');

3)备库 查询MRP进程应用情况
select process,client_process,sequence#,status,BLOCK#,BLOCKS from v$managed_standby;

以上信息确认DG基本正常之后,对主库切换日志进行确认
4)主库切换归档,查询备库是否接受且应用
primary
SQL> select thread#,sequence# from v$log where status='CURRENT';
standby
SQL> select DEST_ID,THREAD#,max(SEQUENCE#) from v$archived_log where APPLIED='YES' group by DEST_ID,THREAD#;
primary
SQL> alter system archive log current;
standby
SQL> select DEST_ID,THREAD#,max(SEQUENCE#) from v$archived_log where APPLIED='YES' group by DEST_ID,THREAD#;
SQL> select process,client_process,sequence#,status,BLOCK#,BLOCKS from v$managed_standby;
SQL> select name from v$archived_log where (thread#,sequence#) in (select THREAD#,max(SEQUENCE#) from v$archived_log where dest_id=1 group by thread#);

如果上述主库切换归档,备库未接收到日志,如下进入,DG问题排查
5)主库查询归档线程状态(查询no error说明正常现象)
set linesize 200
col dest_name for a40
select DEST_NAME , STATUS , RECOVERY_MODE from v$archive_dest_status;

查询归档线程是否异常
select dest_id,error from v$archive_dest;

查询DG报错信息情况
col severity for a15
col message for a70
col timestamp for a20
select severity,error_code,to_char(timestamp,'DD-MON-YYYY HH24:MI:SS') "timestamp" , message from v$dataguard_status where dest_id=4;

查询已经应用的日志列表
select name,applied from v$archived_log where name is not null and applied!='YES';

是否存在GAP异常
select * from v$archive_gap;

上一篇:IOS开发效率之为Xcode添加常用的代码片段


下一篇:MVC和MVVM