ITPub博客

首页 > Linux操作系统 > Linux操作系统 > STREAMS MONITORING

STREAMS MONITORING

原创 Linux操作系统 作者:zhouwf0726 时间:2019-04-20 12:57:04 0 删除 编辑
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博客 ” ,链接:https://blog.itpub.net/756652/viewspace-242479/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: oracle send mail
请登录后发表评论 登录
全部评论

注册时间:2006-02-22

  • 博文量
    458
  • 访问量
    416653