• check the logs and trace files usage
vi /tmp/chk_logs.sh
du -sh /oracle/admin/${ORACLE_SID}/adump
du -sh /oracle/diag/rdbms/${ORACLE_SID}/${ORACLE_SID}/trace/alert_${ORACLE_SID}.log
du -sh /oracle/diag/rdbms/${ORACLE_SID}/${ORACLE_SID}/trace
du -sh /oracle/diag/rdbms/${ORACLE_SID}/${ORACLE_SID}/incident
du -sh /oracle/diag/tnslsnr/`hostname | cut -d . -f 1`/listener/trace/listener.log
du -sh /oracle/diag/tnslsnr/`hostname | cut -d . -f 1`/listener/alert

sh /tmp/chk_logs.sh
  • clean audit files
find /oracle/admin/${ORACLE_SID}/adump -type f -name '*.aud' -mtime +7 -exec rm {} \;
  • archive alert.log
export ALERT_LOG=/oracle/diag/rdbms/${ORACLE_SID}/${ORACLE_SID}/trace/alert_${ORACLE_SID}.log
mv ${ALERT_LOG} ${ALERT_LOG}_`date '+%Y%m%d'`
gzip -1 ${ALERT_LOG}_`date '+%Y%m%d'` &
  • clear trace files
find /oracle/diag/rdbms/${ORACLE_SID}/${ORACLE_SID}/trace -type f -name '*.tr*' -mtime +7 -exec rm {} \;
  • clear incident files
find /oracle/diag/rdbms/${ORACLE_SID}/${ORACLE_SID}/incident -type d -name 'incdir_*' -mtime +7 -exec rm -rf {} \;
  • archive lsnr log
export LSNR_LOG=/oracle/diag/tnslsnr/`hostname | cut -d . -f 1`/listener/trace/listener.log
mv ${LSNR_LOG} ${LSNR_LOG}_`date '+%Y%m%d'`
gzip -1 ${LSNR_LOG}_`date '+%Y%m%d'`
  • clear lsnr xml
find /oracle/diag/tnslsnr/`hostname | cut -d . -f 1`/listener/alert -type f -name '*.xml' -mtime +7 -exec rm {} \;