Clean-up of traces & logs made simple with purgeLogs utility on Exadata/ODA

Managing complex Oracle environments is not an easy task for DBAs. One of most challenging part is cleaning-up traces and logs produced by various components of different Oracle binaries running across the system. Oracle has provided many tools and utilities overtime to maintain the trace and log files with automated space management feature. On a system like Exadata or Oracle Database Appliance (ODA) there are many server components (GI, RDBMS, OSWatcher, OAK, TFA etc) generates traces and logs periodically. If no sufficient space is maintained in the filesystem, there are chances that system can behave abnormally also patching or update activities will fail.

As mentioned above, Oracle has introduced many automated space management features in different Oracle versions at different levels. One of the easy solutions is to use the adrci tool to schedule clean-up of trace/log files at differnt homes.

purgeLogs script , available for download in MOS ID 2081655.1, is a onebutton script with the ability to clean-up automatically all trace/log files. The script needs to be executed as root user and should run separately on each node on cluster environment. It can also be scheduled through crontab for periodically execution. Below is the script usage:

image Courtesy from Oracle, MOS ID 2081655.1

Below are some useful examples:

you can include the Grid Infrastructure & RDBMS Audit files using “-aud” option, example:

# ./purgeLogs -orcl 15 -aud

Cleanup OSWatcher archive files and OAK logs, removing all file older then 35 days

# ./purgeLogs -osw 35 -oda 35
2015–11–24 02:05:10: I Purging OSW archives older then 35 days
2015–11–24 02:05:10: I Purging completed successfully!

Cleanup Alert,Incident,Trace,Cdump,HM for the Grid Infastructure and RDBMS homes + TFA archives + OSWatcher archive files + OAK logs, removing all file older then 30 days (default)

# ./purgeLogs
2015–11–24 03:35:35: I adrci GI purge started 
(…)
2015–11–24 03:35:40: I adrci RDBMS purge started
(…)
2015–11–24 03:35:44: I Purging TFA archives older then 30 days
2015–11–24 03:35:48: I Purging OSW archives older then 30 days
2015–11–24 03:35:48: I Purging ODA logs older then 30 days
2015–11–24 03:35:49: I Purging completed succesfully!

s example, we are setting up purgeODALog to be executed every day at 2.00am purging GI/Rdbms traces older then 20 days and keeping TFA, OSWatcher and ODA logs not older then 10 days

00 02 * * * /opt/utils/purgeLogs -orcl 20 -tfa 10 -osw 10 -oda 10

Note : Oracle doesn’t take the responsibility of the script, therefore, one must be tested the script thoroughly.

References: purgeLogs: Cleanup traces, logs in one command (Doc ID 2081655.1)