通过CONTRAB 执行脚本进行监控

前端之家收集整理的这篇文章主要介绍了通过CONTRAB 执行脚本进行监控前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

切换到ORACLE执行SH的脚本

[email protected]:~# crontab -l
#ident "%Z%%M% %I% %E% SMI"
#
# Copyright 2007 Sun Microsystems,Inc. All rights reserved.
# Use is subject to license terms.
#
# The root crontab should be used to perform accounting data collection.

01 1 * * * su - oracle "/u01/backup/scripts/monscript.sh"

编写SH文件

/u01/scripts/script.rcv >/u01/scripts/script.log

.rcv文件

echo ‘/u01/app/oracle/diag/rdbms/*/trace/alert_*.log

tail -500 /u01/app/oracle/diag/rdbms/*/trace/alert_*.log
echo ‘\n‘
echo ‘集群警告文件crsd.log ‘
echo ‘===============================================================‘
echo ‘/u01/app/crs_home/log/*/crsd/crsd.log‘
tail -100 /u01/app/crs_home/log/*/crsd/crsd.log
sqlplus -s /nolog<<EOF
conn / as sysdba
@script.sql
exit
EOF

编写查询.sql,这里就根据需要执行的语句自行编写就好了。

[email protected]:/u01/scripts$ more script.sql

host echo ‘\n‘host echo ‘数据库状态‘host echo ‘select name,log_mode,open_mode from v$database;‘select name,open_mode from v$database;host echo ‘\n‘host echo ‘数据库登陆记录数量trial_login‘host echo ‘select count(0) from trial_login;‘select count(0) from trial_login;host echo ‘\n‘

猜你在找的Oracle相关文章