Lesson 6 | Renaming alert log |
Objective | Delete and rename old alert log entries. |
The alert log file in Oracle 11g R2 is typically found in the directory specified by the DIAGNOSTIC_DEST
initialization parameter. For older systems or specific setups, you might see references to BACKGROUND_DUMP_DEST
. The exact path can be:
/oracle/<SID>/saptrace/background
<drive>:\oracle\<SID>\saptrace\background
You can check this by querying:
SELECT value FROM v$parameter WHERE name = 'diagnostic_dest';
You can rename the current alert log file while the Oracle instance is running. After renaming, Oracle will automatically create a new alert log file when it needs to write new entries:
mv alert_<SID>.log alert_<SID>_<timestamp>.log
ren alert_<SID>.log alert_<SID>_<timestamp>.log
Replace <SID>
with your Oracle System Identifier and <timestamp>
with a date or any identifier for archival.
You can delete old alert log files manually if you've renamed them. This should be done with caution, as you might need this data for troubleshooting:
rm alert_<SID>_<old_timestamp>.log
Ensure you keep some history for troubleshooting purposes.
ADRCI allows for more systematic management of diagnostic data, including alert logs:
adrci
set home diag/<path_to_your_adr_home>
purge -age <minutes>
Here, <minutes>
is how far back you want to keep the data. For instance, to purge all data older than 30 days (720 hours):
purge -age 43200
Note that ADRCI primarily deals with XML logs, not text-based logs directly, but setting retention policies can help manage space.
For regular maintenance, consider scheduling a script to run these commands periodically. This could involve creating a shell script or a Windows batch file that renames the current log, deletes old logs, and possibly compresses or moves them to an archive location.
Remember, these actions can be performed without shutting down the database, but always ensure you have recent backups or copies of logs for troubleshooting.
NT: rename coinalrt.log coinalrt_991115.log UNIX: mv coinalrt.log coinalrt_991115.log