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:TABLE MONITORINGOracle
- Go: sysmon, Runtime MonitoringGo
- PostgreSQL DBA(77) - Locks(Lock Monitoring)SQL
- PostgreSQL DBA(189) - PG 14 Monitoring ImprovementsSQL
- Streams 流處理
- 精讀《web streams》Web
- Azkarra Streams簡介:Apache Kafka Streams的第一個微框架ApacheKafka框架
- godaddy 的 Monitoring performance to make your website fasterGoORMWebAST
- Flutter Provider and Streams [翻譯]FlutterIDE
- 流和向量(Streams and Vectors)
- Java Streams 的潛力Java
- Node.js Streams(流)Node.js
- PostgreSQL DBA(142) - PG 12(Monitoring PostgreSQL VACUUM processes)SQL
- Design and implementation of database anomaly monitoring system based on AI algorithmDatabaseAIGo
- 聊聊rocketmq-streams的ILeaseServiceMQ
- PostgreSQL DBA(143) - pgAdmin(Monitoring PostgreSQL VACUUM processes#2)SQL
- asyncio非同步IO——Streams詳解非同步
- Kafka Streams開發入門(1)Kafka
- java .stream(). 使用介紹 Streams APIJavaAPI
- How to Use the Stdin, Stderr, and Stdout Streams in Bash
- 11.Wagtail streams應用-2AI
- Node.js Streams 基礎總結Node.js
- How to open and close static streams in a USB bulk endpoint
- (六)Redis 訊息佇列 List、StreamsRedis佇列
- 8個實用的Java Streams APIJavaAPI
- RediSearch和Redis Streams實戰原始碼Redis原始碼
- 圖解JanusGraph系列 - JanusGraph指標監控報警(Monitoring JanusGraph)圖解指標
- 使用Spring Boot和Kafka Streams實現CQRSSpring BootKafka
- oracle9i下streams複製(zt)Oracle
- 2.3 Streams API 官網剖析(博主推薦)API
- 使用Java和Reactive Streams構建流式應用JavaReact
- 【譯】Redis喜提新資料結構:Redis StreamsRedis資料結構
- 如何使用Java Streams進行資料庫查詢?Java資料庫
- Kafka Streams+SpringBoot之探索:統計計數 - mydeveloperplanetKafkaSpring BootDeveloper
- [20191211]11g streams_pool_size引數.txt
- [Most.js] Create Streams From Single Values With Most.jsJS
- RocketMQ Streams 1.1.0: 輕量級流處理再出發MQ
- Nginx R31 doc-15-Live Activity Monitoring 實時活動監控Nginx