# Using Logrotate to Manage Oracle Database Alert and Listener Log Files
As root, manually create a configuration file /etc/logrotate.d/oracle-database as below:
# alert log | |
/u01/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.log | |
/u01/app/oracle/diag/rdbms/coco/coco/trace/alert_coco.log { | |
daily | |
rotate 7 | |
compress | |
copytruncate | |
delaycompress | |
create 0640 oracle oinstall | |
notifempty | |
missingok | |
} | |
# listener log | |
/u01/app/oracle/diag/tnslsnr/oracle19c/li_orcl/trace/li_orcl.log | |
/u01/app/oracle/diag/tnslsnr/oracle19c/li_coco/trace/li_coco.log { | |
daily | |
rotate 7 | |
compress | |
copytruncate | |
delaycompress | |
create 0640 oracle oinstall | |
notifempty | |
missingok | |
} |
To test the script run normally.
logrotate -f /etc/logrotate.d/oracle-database |
Reference:
・ How to use logrotate utility to rotate log files