切换到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
[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‘