STREAMS MONITORING
create or replace PROCEDURE STREAMS_MONITORING AS
v_cap_status number;
v_prop_status number;
v_apply_status number;
v_apply_err_amt number;
v_subject VARCHAR2(250);
v_message VARCHAR2(500);
BEGIN
v_apply_err_amt :=0;
-- Check the status of stream capture
SELECT DECODE(STATUS, 'ENABLED', 1, 'DISABLED', 0 ) into v_cap_status
FROM DBA_CAPTURE
where capture_name ='STRM_CAPTURE';
DBMS_OUTPUT.PUT_LINE('Check the status of stream capture' ||v_cap_status );
if v_cap_status <> 1
then
admin.p_send_mail( sender=>'db-...-r3.idc.com',recipient=>'db-monitoring@amazon.com', ccrecipient=>'weifengz@amazon.com', subject=>'[FC1CN] Replication Failure: Replication Process From FC1CN to FCDW1CN fail!',message=>'Replicaton Process failure, pls contact DBA immediate');
-- Send alarm email and then exit the monitoring
DBMS_OUTPUT.PUT_LINE('return');
return;
end if;
-- Check the status of stream propagation
SELECT DECODE(s.SCHEDULE_DISABLED, 'Y', 0, 'N', 1 ) into v_prop_status
FROM DBA_QUEUE_SCHEDULES s, DBA_PROPAGATION p
WHERE p.DESTINATION_DBLINK = s.DESTINATION
AND s.SCHEMA = p.SOURCE_QUEUE_OWNER
AND s.QNAME = p.SOURCE_QUEUE_NAME;
DBMS_OUTPUT.PUT_LINE('Check the status of stream propagation' ||v_prop_status );
if v_prop_status <> 1
then
admin.p_send_mail( sender=>'db-...-r3.idc.com',recipient=>'db-monitoring@amazon.com', ccrecipient=>'weifengz@amazon.com', subject=>'[FC1CN] Replication Failure: Replication Process From FC1CN to FCDW1CN fail!',message=>'Replicaton Process failure, pls contact DBA immediate');
-- Send alarm email and then exit the monitoring
DBMS_OUTPUT.PUT_LINE('return');
return;
end if;
-- Check the status of apply
SELECT decode(status, 'ENABLED',1, 'DISABLED', 0) into v_apply_status
FROM DBA_APPLY@fcdw1cn.amazon
where apply_name ='STRM_APPLY';
DBMS_OUTPUT.PUT_LINE('Check the status of apply ' ||v_apply_status );
if v_apply_status <> 1
then
admin.p_send_mail( sender=>'db-...-r3.idc.com',recipient=>'db-monitoring@amazon.com', ccrecipient=>'weifengz@amazon.com',subject=>'[FC1CN] Replication Failure: Replication Process From FC1CN to FCDW1CN fail!',message=>'Replicaton Process failure, pls contact DBA immediate');
-- Send alarm email and then exit the monitoring
DBMS_OUTPUT.PUT_LINE('return');
return;
end if;
-- Check the apply error in destination database
select count(*) into v_apply_err_amt
from dba_apply_error@fcdw1cn.amazon
where apply_name ='STRM_APPLY';
DBMS_OUTPUT.PUT_LINE('----- BEGIN ERROR #' ||v_apply_err_amt );
if v_apply_err_amt > 0
then
SYS.DBMS_System.ksdwrt(2, 'ORA-00600: Replication Failure');
admin.p_send_mail( sender=>'db-...-r3.idc.com',recipient=>'db-monitoring@amazon.com', ccrecipient=>'weifengz@amazon.com', subject=>'[FC1CN] Replication Failure: Replication Process From FC1CN to FCDW1CN fail!',message=>'Replicaton Process failure, pls contact DBA immediate');
-- Send alarm email and then exit the monitoring
return;
end if;
EXCEPTION
WHEN OTHERS then
null ;
END;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/756652/viewspace-242479/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle Streams STRMMON Monitoring Utility [ID 290605.1]Oracle
- Column Monitoring
- Oracle StreamsOracle
- STREAMS筆記(2) 其他建立Streams的方式筆記
- Oracle:TABLE MONITORINGOracle
- oracle index monitoringOracleIndex
- Monitoring WebSite StateWeb
- Kafka Streams 剖析Kafka
- streams 總結
- Oracle EBS Monitoring ScriptsOracle
- Monitoring an SAP instance
- sql monitoring實驗SQL
- Monitoring Core Process...
- Monitoring Open and Cached Cursors
- Monitoring RMAN Backups
- 精讀《web streams》Web
- Java 8 Streams filterJavaFilter
- Java 8 Streams map()Java
- Streams 流處理
- Azkarra Streams簡介:Apache Kafka Streams的第一個微框架ApacheKafka框架
- 在Oracle11g Streams測試Streams資料傳輸Oracle
- Go: sysmon, Runtime MonitoringGo
- Oracle Real Time SQL MonitoringOracleSQL
- Monitoring Open and Cached Cursors(zt)
- STREAMS筆記(1) step by step 建立一個Streams複製環境筆記
- Node.js Streams(流)Node.js
- 理解 PHP 中的 StreamsPHP
- STREAMS筆記(6) rule筆記
- Oracle Stream(2)--Streams功能Oracle
- Oracle Stream(1)--Streams概述Oracle
- Java Streams 的潛力Java
- 流和向量(Streams and Vectors)
- Oracle9i Table monitoring 及10g table預設monitoring屬性Oracle
- PostgreSQL DBA(77) - Locks(Lock Monitoring)SQL
- 對索引開啟monitoring方法索引
- Top DBA Shell Scripts for Monitoring the DatabaseDatabase
- Monitoring Open and Cached Cursors(轉載)
- Java Monitoring, Management and Troubleshooting ToolsJava