在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