We are leveraging the logrotate linux executable to rotate ASM log files, database alert log files, and listener log files.  With log rotate we have the option to compress the previous version of the log file, keep X amount of copied of the log file, rotate the log file on a hourly/daily/weekly/monthly  intervals, etc.

rac22:/apps/oracle/general/sh

DBATOOLS3 – oracle: cat log_rotate.rac22.ksh
export CONF=/tmp/alertlog.conf
cat <<!! >$CONF
/apps/oracle/diag/rdbms/dbatools/DBATOOLS3/trace/alert_DBATOOLS3.log {
weekly
copytruncate
rotate 4
compress
}
!!
 
logrotate -s $SH/log_rotate_status -f $CONF
 
export CONF=/tmp/alert_asm.conf
cat <<!! >$CONF
/apps/oracle/diag/asm/+asm/+ASM3/trace/alert_+ASM3.log {
weekly
copytruncate
rotate 4
compress
}
!!
logrotate -s $SH/log_rotate_status -f $CONF
 
export CONF=/tmp/listener.conf
cat <<!! >$CONF
/apps/oracle/diag/tnslsnr/rac22/listener/trace/listener.log {
weekly
copytruncate
rotate 4
compress
}
!!
logrotate -s $SH/log_rotate_status -f $CONF
 
export CONF=/tmp/extproc_listener.conf
cat <<!! >$CONF
/apps/oracle/diag/tnslsnr/rac22/extproc_listener/trace/extproc_listener.log {
monthly
copytruncate
rotate 4
compress
}
!!
logrotate -s $SH/log_rotate_status -f $CONF
 
 
export CONF=/tmp/alertlog.conf
cat <<!! >$CONF
/apps/oracle/diag/rdbms/gridrac/GRIDRAC3/trace/alert_GRIDRAC3.log {
weekly
copytruncate
rotate 4
compress
}
!!
logrotate -s $SH/log_rotate_status -f $CONF

$ cat del_DBATOOLS_dbca.txt
dbca -silent -deleteDatabase -sourceDB DBATOOLS -sysDBAUserName sys -sysDBAPassword xxx4DBA

RMANDR – oracle: ksh del_DBATOOLS_dbca.txt

Connecting to database
4% complete
9% complete
14% complete
19% complete
23% complete
28% complete
47% complete
Updating network configuration files
52% complete
Deleting instance and datafiles
76% complete
100% complete
Look at the log file “/apps/oracle/cfgtoollogs/dbca/DBATOOLS.log” for further details.