首页 > 应用开发 > XML/XSL > oracle alert日志
但是有个问题,就是如果alert 日志太大,会导致zabbix 监控慢,甚至会超时,所以要定期归档alert log。我写了个归档alert log的脚本,参考如下。
|
1
2
3
4
5
6
7
8
9
10
11 |
[root@node2 trace]
# cat /usr/local/shell/alert_clear.sh#!/bin/bashset
-uset
-eset
-o pipefailalertlog_path=
/opt/oracle/diag/rdbms/orcldg/orcl/trace/date1=$(
date
+%Y%m%d_%H%M%S)su
- oracle -c
"cp -a ${alertlog_path}alert_orcl.log ${alertlog_path}alert_orcl.log_${date1}"su
- oracle -c
"echo > ${alertlog_path}alert_orcl.log"echo
>
/tmp/tmp_alertrows
.txtfind
${alertlog_path} -name
"alert_orcl.log_*"
-mtime +30 |
xargs
rm
-rf |
|
1
2
3 |
[root@node2 trace]
# crontab -l#归档alert日志50 00 * * *
/usr/local/shell/alert_clear
.sh
|
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69979754/viewspace-2706253/ ,如需转载,请注明出处,否则将追究法律责任。