总结表中有无数据并发送邮件

wwwlehu6.vip乐虎官网,在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地图