Oracle   发布时间:2022-05-17  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Oracle 11g R2 ADG 监控大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

--===============在standby监控DG的恢复过程==================

v$managed_standby
v$archived_standby
v$archive_desc_status
v$log_history


--在主库查看状态
SELEct dest_name,status,error from v$archive_dest;

--在standby上查询最后收到和应用的归档日志
--archived_seq# 和 applIEd_seq#的差值就是standby上需要应用priMary上的日志数量
--这个只是显示standby上的可用日志和已应用日志
--有可能日志没有从priMary传到standby,这种情况下更多日志需要同步到standby

SELEct archived_THREAD#,archived_seq#,applIEd_THREAD#,applIEd_seq#
from v$archive_dest_status;


--上面的archived_seq#需要与priMary上的最后归档日志相比较
--priMary上的最后归档日志可以从v$log_history上的SEQUENCE#得到
--在priMary上执行

SELEct max(SEQUENCE#) latest_archive_log
from v$log_history;


--每个归档日志的管理恢复进程的详细过程可以从v$archived_log得到
--registrar中的RFS表示日志从priMary通过日志传输服务传输过来
--在standby上执行
--备注:registrar='RFS'并且applIEd='YES'的归档日志可以从standby的归档日志位置安全移除

SELEct THREAD#,SEQUENCE#,applIEd,registrar
from v$archived_log;


--在管理恢复操作中,在standby有各种进程,可以从v$managed_standby看到进程状态。

SELEct process,status
from v$managed_standby;


--查看DG的基本统计信息
--在standby上执行
set linesize 150
column value format a20
SELEct * from v$dataguard_stats;

set linesize 2000
SELEct sysdate,sum(apply_finish) apply_finish,
sum(apply_lag) apply_lag,
sum(transport_lag) transport_lag,
sum(STARTUP_TIME) STARTUP_TIME,@H_84_3@min(TIME_COmpuTED) TIME_COmpuTED
from
(
SELEct
decode(name,'apply finish time',to_number(substr(value,2,2))*86400+to_number(substr(value,5,2))*3600 +to_number(substr(value,8,2))*60 +to_number(substr(value,11,2)),0) apply_finish,
decode(name,'apply lag',0) apply_lag,'transport lag',0) transport_lag,'estimated startup time',value,0) STARTUP_TIME,
TIME_COmpuTED
from v$dataguard_stats
where name in (
'apply finish time',
'apply lag',
'estimated startup time',
'transport lag' )
)


--在standby上执行
Set linesize 140
column timestamp Format a20
column Facility Format a24
column Severity Format a13
column message Format a60 trunc

SELEct
TO_CHAR(timestamp,'YYYY-MON-DD HH24:MI:SS') timestamp,
Facility,
Severity,
message
From
v$dataguard_status
Order by
timestamp;


SELEct *
from (SELEct timestamp,
completion_time "ArchTime",
SEQUENCE#,
round((blocks * BLOCK_SIZE) / (1024 * 1024),1) "Size Meg",
round((timestAMP - lag(timestAMP,1,timestamp)
OVER(order by timestamp)) * 24 * 60 * 60,
1) "Diff(seC)",
round((blocks * BLOCK_SIZE) / 1024 /
decode(((timestAMP - lag(timestAMP,timestamp)
OVER(order by timestamp)) * 24 * 60 * 60),
0,
1,
(timestAMP - lag(timestAMP,
1) "KB/sec",
round((blocks * BLOCK_SIZE) / (1024 * 1024) /
decode(((timestAMP - lag(timestAMP,
3) "MB/sec",
round(((lead(timestAMP,timestamp) over(order by timestamp)) -
completion_timE) * 24 * 60 * 60,
1) "Lag(seC)"
from v$archived_log a,v$dataguard_status dgs
where a.name = replace(dgs.messaGE,'Media Recovery Log ','')
and dgs.FACIliTY = 'Log Apply services'
order by timestAMP desc)
where rownum < 10;

--PHYSICAL STANDBY / MAXIMUM PERFORMANCE
SELEct database_role,LOG_MODE,protection_mode,PROTECTION_LEVEL from v$database;

SELEct db_unique_name from v$dataguard_config

--在备用数据库上检查是否有archive redo log gapssql>SELECT THREAD#,LOW_SEQUENCE#,HIGH_SEQUENCE# FROM v$ARCHIVE_GAP;

大佬总结

以上是大佬教程为你收集整理的Oracle 11g R2 ADG 监控全部内容,希望文章能够帮你解决Oracle 11g R2 ADG 监控所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:status