最佳實踐(保持、清理ORACLE alert日誌)
Please modify the script variables below to your specifics.
LOGFILE_DIR
RETENTION_DAYS
RETENTION_SIZE
RUEI has a script called clean.sh
--------------------------------
#!/bin/bash
#
# Automatically clean the Automatic Diagnostics Repository (ADR) directories.
#
source /etc/ruei.conf &>/dev/null
RETENTION_DAYS=7
RETENTION_SIZE=10M
export PATH=$PATH:/usr/local/bin # oraenv needs to find dbhome
export ORACLE_SID=$RUEI_DB_INST # oraenv looks for this name in /etc/oratab
ORAENV_ASK=NO . oraenv &>/dev/null 0>&-
[ -z "${ORACLE_BASE}" ] && exit 1
[ -z "${ORACLE_HOME}" ] && exit 1
for dir in $ORACLE_BASE/diag \
$ORACLE_HOME/log
do
#
# Too big files are moved to .bak (and .bak files will be removed when
# they become too old).
#
find ${dir} -type f -size +$RETENTION_SIZE '!' -name '*.bak' \
-exec mv '{}' '{}.bak' ';'
#
# Too old files are removed.
#
find ${dir} -type f -mtime +$RETENTION_DAYS -exec rm -f '{}' ';'
done &>/dev/null
exit 0
--------------------------------
you can modify the script as follows, just replace the right directory for LOGFILE_DIR:
--------------------------------
#!/bin/bash
#
LOGFILE_DIR= /usr/lib/oracle/11.2/client64/lib/log/diag/clients/user_moniforce....
RETENTION_DAYS=7
RETENTION_SIZE=10M
export PATH=$PATH:/usr/local/bin # oraenv needs to find dbhome
for dir in $LOGFILE_DIR
do
#
# Too big files are moved to .bak (and .bak files will be removed when
# they become too old).
#
find ${dir} -type f -size +$RETENTION_SIZE '!' -name '*.bak' \
-exec mv '{}' '{}.bak' ';'
#
# Too old files are removed.
#
find ${dir} -type f -mtime +$RETENTION_DAYS -exec rm -f '{}' ';'
done &>/dev/null
exit 0
--------------------------------
Please put it in the cron,
type 'man crontab', then '5' for details details on the syntax for the schedule frequency,
(the syntax requires higher maths, so luckily examples are included)
LOGFILE_DIR
RETENTION_DAYS
RETENTION_SIZE
RUEI has a script called clean.sh
--------------------------------
#!/bin/bash
#
# Automatically clean the Automatic Diagnostics Repository (ADR) directories.
#
source /etc/ruei.conf &>/dev/null
RETENTION_DAYS=7
RETENTION_SIZE=10M
export PATH=$PATH:/usr/local/bin # oraenv needs to find dbhome
export ORACLE_SID=$RUEI_DB_INST # oraenv looks for this name in /etc/oratab
ORAENV_ASK=NO . oraenv &>/dev/null 0>&-
[ -z "${ORACLE_BASE}" ] && exit 1
[ -z "${ORACLE_HOME}" ] && exit 1
for dir in $ORACLE_BASE/diag \
$ORACLE_HOME/log
do
#
# Too big files are moved to .bak (and .bak files will be removed when
# they become too old).
#
find ${dir} -type f -size +$RETENTION_SIZE '!' -name '*.bak' \
-exec mv '{}' '{}.bak' ';'
#
# Too old files are removed.
#
find ${dir} -type f -mtime +$RETENTION_DAYS -exec rm -f '{}' ';'
done &>/dev/null
exit 0
--------------------------------
you can modify the script as follows, just replace the right directory for LOGFILE_DIR:
--------------------------------
#!/bin/bash
#
LOGFILE_DIR= /usr/lib/oracle/11.2/client64/lib/log/diag/clients/user_moniforce....
RETENTION_DAYS=7
RETENTION_SIZE=10M
export PATH=$PATH:/usr/local/bin # oraenv needs to find dbhome
for dir in $LOGFILE_DIR
do
#
# Too big files are moved to .bak (and .bak files will be removed when
# they become too old).
#
find ${dir} -type f -size +$RETENTION_SIZE '!' -name '*.bak' \
-exec mv '{}' '{}.bak' ';'
#
# Too old files are removed.
#
find ${dir} -type f -mtime +$RETENTION_DAYS -exec rm -f '{}' ';'
done &>/dev/null
exit 0
--------------------------------
Please put it in the cron,
type 'man crontab', then '5' for details details on the syntax for the schedule frequency,
(the syntax requires higher maths, so luckily examples are included)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29446986/viewspace-1708597/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle alert日誌Oracle
- 日誌最佳實踐
- 歸檔oracle alert日誌Oracle
- Java 日誌管理最佳實踐Java
- oracle清理trace、alert、aud、listener等日誌檔案Oracle
- Docker容器日誌管理最佳實踐Docker
- oracle alert日誌每天截斷truncate_alert.shOracle
- oracle 審計日誌清理Oracle
- oracle清理監聽日誌Oracle
- Oracle歸檔日誌清理Oracle
- oracle alert日誌亂碼處理Oracle
- 日誌服務 HarmonyOS NEXT 日誌採集最佳實踐
- oracle歸檔日誌過滿清理Oracle
- oracle 11g檢視alert日誌方法Oracle
- ORACLE 告警日誌alert過大的處理Oracle
- Kubernetes日誌的6個最佳實踐
- 雲原生架構日誌監控最佳實踐架構
- mysql清理日誌MySql
- 清理日誌 scripts
- 如何清理日誌
- 使用sql查alert日誌SQL
- Oracle 警告日誌 (alert log) 中包含哪些內容 ?Oracle
- 騰訊雲容器服務日誌採集最佳實踐
- 從alert日誌看Oracle 11g Datagurad日誌傳輸(上)Oracle
- 從alert日誌看Oracle 11g Datagurad日誌傳輸(下)Oracle
- 王健:最佳日誌實踐
- Oracle之備份和清理監聽日誌、告警日誌指令碼Oracle指令碼
- rac scan listener log 清理監聽日誌 oracleOracle
- 用外部表實現Alert日誌的檢視
- Docker容器日誌清理Docker
- 行為、審計日誌(實時索引/實時搜尋)-最佳實踐索引
- 【alert】每週自動備份alert日誌檔案
- 透過alert日誌看Oracle Startup的三個階段Oracle
- Oracle的告警日誌之v$diag_alert_ext檢視Oracle
- oracle 中 alert 報警日誌過大的處理方法Oracle
- UBC SDK日誌級別重複率最佳化實踐
- 警告日誌檔案alert_.log
- 熟練使用alert.log日誌