Rotational script of alert log file for Linux Operating System

Rotational script to rotate the alert log

Script help to rotate the alert log file or any log file.

You will need to provide the following parameter

ORACLE_SID: Name of the database
LOG_FILE: Location of the alert log file

It will rotate according to CRONTAB scheduled and it will rename old alert log file with prefix date.

Note: Last statement in the script FOR remove the older file more than 30 days. you can change +30 to +90 for older than 90 days as your wish you can modified.


DATE_FORMAT='date +"%Y"-"%m"-"%d"'
touch alert$ORACLE_SID.log

# Delete old log files more than 30 days you can change it by change +30 value to +60 for 60 days older and so on

find $LOG_FILE/alert*.log -mtime +30 -delete;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.