ogg 监控脚本

section 1:

#! /bin/sh

PATH=/usr/local/bin:$PATH
ORACLE_SID=statdb
ORAENV_ASK=NO
. oraenv > /dev/null 2>&1

cd /home/oracle/utility/OGG_delay
sqlplus "/ as sysdba" <<_EOF
@q_delay_testRO.sql
_EOF


section 2:
alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS'
/
set pages 20000

col txn_date head 'Date'
col txn_time head 'Time'
col no_of_times head 'Occurance'
col delay_in_seconds head 'Delay (seconds)'
col total_delay      head 'Delay (seconds)' for a15

spool q_delay.lst

prompt OGG testRO delay list (last 7 hours)
prompt running at 7:00,13:00 everyday in temporary.
prompt ========================

--select '< '||ceil((LAST_UPDATED_TIME-last_transaction_datetime)*3600*24/10)||'0' total_delay, count(*) no_of_times
--from gguser.gguser_delay@testRO
--where last_transaction_datetime between (sysdate - 420/1440) and trunc(sysdate + 1)
--group by '< '||ceil((LAST_UPDATED_TIME-last_transaction_datetime)*3600*24/10)||'0'
--order by 1 desc
--/

select '< '||ceil_delay "YICT_OGG_DELAY (in seconds)", count(*) from
(
select to_char(LAST_UPDATED_TIME,'dd-mon-yy hh24:mi:ss'),
round((LAST_UPDATED_TIME-last_transaction_datetime)*3600*24) absdelay,
floor(round((LAST_UPDATED_TIME-last_transaction_datetime)*3600*24)/10)*10+10 ceil_delay
from gguser.gguser_delay@testRO
--where LAST_UPDATED_TIME between trunc(sysdate) and trunc(sysdate + 1)
where last_transaction_datetime between (sysdate - 420/1440) and trunc(sysdate + 1)
) group by ceil_delay
order by ceil_delay Desc
/

select to_char(last_transaction_datetime,'YYYYMMDD HH24:MI:SS') txn_date_time, (LAST_UPDATED_TIME-last_transaction_datetime)*3600*24 delay_in_seconds
from gguser.gguser_delay@testRO
where last_transaction_datetime between (sysdate - 420/1440) and trunc(sysdate + 1)
order by txn_date_time
/

spool off

转载于:https://www.cnblogs.com/feiyun8616/p/6400655.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值