Oracle 11g R2 ADG 监控
admin
2023-04-18 12:23:56
0

--===============在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,sequence#,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,
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',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_lag,
decode(name,'transport lag',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) transport_lag,
decode(name ,'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, 1, TIMESTAMP)
                              OVER(order by TIMESTAMP)) * 24 * 60 * 60),
                             0,
                             1,
                             (TIMESTAMP - lag(TIMESTAMP, 1, TIMESTAMP)
                              OVER(order by TIMESTAMP)) * 24 * 60 * 60),
                      1) "KB/sec",
                round((blocks * block_size) / (1024 * 1024) /
                      decode(((TIMESTAMP - lag(TIMESTAMP, 1, TIMESTAMP)
                              OVER(order by TIMESTAMP)) * 24 * 60 * 60),
                             0,
                             1,
                             (TIMESTAMP - lag(TIMESTAMP, 1, TIMESTAMP)
                              OVER(order by TIMESTAMP)) * 24 * 60 * 60),
                      3) "MB/sec",
                round(((lead(TIMESTAMP, 1, 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 gaps
SQL>SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;

相关内容

热门资讯

英国将向霍尔木兹海峡多国护航行... 当地时间12日,总台记者从英国国防部获悉,英国将向在霍尔木兹海峡执行任务的多国护航行动提供无人机、战...
强化技术引领场景培育政策保障 ... 5月11日,省长叶建春就脑机接口技术与产业创新工作开展专题调研。他强调,脑机接口是培育未来产业发展新...
上海交大王如竹教授领衔撰写的“... 4月30日,国际制冷学会(IIR,International Institute of Refrig...
非人类身份蔓延:智能体AI真正... 长期以来,企业依赖服务账户、API密钥、OAuth令牌等各类非人类身份凭证,使不同服务能够在数字环境...
脑机接口“狂飙” 从病房走向多... (记者 陈锦锋)当大脑的神经信号能够直接与外部设备对话,“心想事成”便从科幻走向现实。近日,中南大学...
中巴外长通话,王毅:希望巴方保... 2026年5月12日晚,中共中央政治局委员、外交部长王毅同巴基斯坦副总理兼外长达尔通电话。达尔介绍了...
美参议院投票批准凯文·沃什出任... △凯文·沃什(资料图)当地时间5月12日,美国参议院投票批准凯文·沃什出任美联储主席,目前相关投票程...
缺油!日本快撑不住了 日本零食巨头卡乐比为节省油墨竟将原本漂亮的包装改成了黑白两色,从“喜食”变得看上去像“丧食”。日本石...
英国首相斯塔默再遭逼宫,在内阁... 【文/观察者网 熊超然】在上周经历地方选举惨败后,作为执政党领袖的英国首相斯塔默于当地时间5月11日...
日防相声称:新西兰考虑进口日本... 据凤凰卫视报道,5月12日,日本防卫大臣小泉进次郎在记者会上表示,新西兰已将日本海上自卫队最上型改良...