Oracle database logs doesn’t rotate by it self.
As time goes by, the server may hold logs that are too big to read and takes too much storage space.
This can get your server to a maximum capacity or cause the listener can’t start.
The best solution is to use logrotate:
There are 2 log files needs to be rotate:
Alert log and Listener log
Create new logrotate rules by edit a files under /etc/logrotate.d/
# Logrotate file for Oracle Alert
create 640 oracle oinstall
# Logrotate file for Oracle Listener
create 644 oracle oinstall
su - oracle -c "lsnrctl set Log_status off"
su - oracle -c "lsnrctl set Log_status on"
This command can be useful if you want the archived logs to be compressed, but not right away.
With “delaycompress” active an archived log won’t be compressed until the next time the log is rotated.
Note that “delaycompress” only works if you also have “compress” in your config.
To test it out:
/usr/sbin/logrotate -vdf /etc/logrotate.conf
To force run it:
/usr/sbin/logrotate -vf /etc/logrotate.conf