Friday, November 13, 2009

Log rotation for alertSID.log and LISTENER_SID.log

1. Alert.log

cp alertSID.log alertSID.log.`date "+%m%d%y"`
> alertSID.log

or
cat /dev/null >alertSID.log

For the old version of databases, if you delete the alertSID.log, due to the file descriptor issue, you have to bounce the database so that a new alert.log will be created. See Note 122401.1 deleting the alert.log when the database is up. See Note 296354.1 How do you reduce the size of an alert.log that is too large to edit while the DB is running for not using mv command for alert.log. Above approach is better than the one mentioned in Note 74966.1: Renaming or deleting the alert.log while an Oracle instance is up and running.


2. listener.log

cp listener.log listener.log.`date "+%m%d%y"`
> listener.log

I tried this approach for 10gR2 and 11gR2 DB listener. The old way is too much trouble. See Note 739530.1: How to delete or refresh/recycle a SQL*Net Listener log file while the Listener is active.


Put above commands in a shell script (need to set the path for alert.log and listener.log), run once a month will be enough.

No comments:

Post a Comment