想了一个笨方法来监控主用机的alter_sid.log文件.
[@more@]$more alert_tbdb2in1.log|grep "Creating archive destination"
Creating archive destination LOG_ARCHIVE_DEST_2: 'db213'
Creating archive destination LOG_ARCHIVE_DEST_1: '/opt/oracle/archive/tbdb2/1_20146.dbf'
Creating archive destination LOG_ARCHIVE_DEST_2: 'db213'
Creating archive destination LOG_ARCHIVE_DEST_1: '/opt/oracle/archive/tbdb2/1_20147.dbf'
Creating archive destination LOG_ARCHIVE_DEST_2: 'db213'
Creating archive destination LOG_ARCHIVE_DEST_1: '/opt/oracle/archive/tbdb2/1_20148.dbf'
Creating archive destination LOG_ARCHIVE_DEST_1: '/opt/oracle/archive/tbdb2/1_20149.dbf'
Creating archive destination LOG_ARCHIVE_DEST_2: 'db213'
Creating archive destination LOG_ARCHIVE_DEST_2: 'db213'
Creating archive destination LOG_ARCHIVE_DEST_1: '/opt/oracle/archive/tbdb2/1_20150.dbf'
$more alert_tbdb2in1.log|grep "Creating archive destination"|wc -l
10
如果wc -l返回结果是双数就表示正确的,否则就是有问题,要发email或短信通知.
发现上面的方法太麻烦,想出一个简单的方法:
create or replace procedure up_check_remotearch
as
v_arch number(3);
begin
select count(*) into v_arch
from v$archived_log
where sequence# in (select max(sequence#) from v$archived_log);
if v_arch = 1 then
sys.dbms_system.ksdwrt(2,'ORA-99999 远程归档已经停止,请检查!');
else
sys.dbms_system.ksdwrt(2,'监控状态: 远程归档正常运行,请放心!');
end if;
end;
var job number;
exec dbms_job.submit(:job,'up_check_remotearch;',sysdate,'sysdate+5/1440');
这样只需要用shell监控ORA-99999这个自定义错误号却可.
以前主要在standby上做检查,有次ssh配置出了问题,
检查的结果没有发出去,导致dataguard重做,
后来就想到在primary上进行检查,写alert_sid.log
的好处是,错误通知有其它的查错程序处理.
呵呵,方法倒是很多的
从 standby 发起任务检查 本地 v$archived_log 和远程primary 上的 v$archived_log 之间的差异也可以。
当然,在primary上crontab检查,不用还写alert log 也可以,这么做是不是显得复杂了?
biti_rainy | 13/04/2005, 23:45
发现上面的方法太麻烦,想出一个简单的方法:
create or replace procedure up_check_remotearch
as
v_arch number(3);
begin
select count(*) into v_arch
from v$archived_log
where sequence# in (select max(sequence#) from v$archived_log);
if v_arch = 1 then
sys.dbms_system.ksdwrt(2,'ORA-99999 远程归档已经停止,请检查!');
else
sys.dbms_system.ksdwrt(2,'监控状态: 远程归档正常运行,请放心!');
end if;
end;
var job number;
exec dbms_job.submit(:job,'up_check_remotearch;',sysdate,'sysdate+5/1440');
这样只需要用shell监控ORA-99999这个自定义错误号却可.
xzh | 12/04/2005, 14:28
有道理!
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14377/viewspace-891002/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/14377/viewspace-891002/