统计表中产生无多少并发送邮件

在ORACLE中,有时我们得看清有表中是否发生了数量,但是我们无克每天去查,所以可以为此底的本子实现:如果该表产生了数额,系统自动发送邮件至邮箱

#!/bin/bash
sqlplus -s "/ as sysdba">tables.log  <<eof
set heading off
select count(*) from dba_users;
exit
eof

tt=$(cat tables.log|grep [0-9])
if (( $tt > 0 )) ;then
        echo "正常"
    sendmail
else
        echo "异常"
fi

  

You can leave a response, or trackback from your own site.

Leave a Reply

网站地图xml地图