Managing Oracle RAC Log Retention and Disk Space Cleanup

Oracle Real Application Clusters (RAC) environments accumulate substantial diagnostic and audit logs over time. When local storage approaches capacity thresholds, proactive log cleanup becomes essential to maintain system staiblity and avoid operasional disruptions. The following procedures apply to Oracle Database 12c through 19c deployments.

Audit Log Rotation and Purge

Audit logs reside in distinct directories for database and ASM instances, controlled by the audit_file_dest initialization parameter.

Database instance audit location:

SELECT value FROM v$parameter WHERE name = 'audit_file_dest';
-- Example output: /u01/app/oracle/admin/orcl/adump

ASM instance audit location:

-- Connect to ASM instance
SELECT value FROM v$parameter WHERE name = 'audit_file_dest';
-- Example output: /u01/app/19.3.0/grid/rdbms/audit

To purge audit files older than seven days:

# For database instances (run as oracle user)
cd /u01/app/oracle/admin/orcl/adump
find . -type f -name "*.aud" -mtime +7 -delete

# For ASM instances (run as grid user)
cd /u01/app/19.3.0/grid/rdbms/audit
find . -type f -name "*.aud" -mtime +7 -delete

Trace File Management

Diagnostic trace files are stored under the Automatic Diagnostic Repository (ADR) hierarchy and require retention-based pruning.

CRS trace files:

# As grid user
cd $ORACLE_BASE/diag/crs/$(hostname)/crs/trace
find . -type f \( -name "*.trc" -o -name "*.trm" \) -mtime +7 -delete

Database instance trace files:

# As oracle user
cd $ORACLE_BASE/diag/rdbms/orcl/orcl2/trace
find . -type f \( -name "*.trc" -o -name "*.trm" \) -mtime +7 -delete

Listener Log Maintenance

Each listener maintains two log types: rotating XML alert logs and a persistent plain-text .log file. Handling differs between them.

XML alert logs (safe to delete directly): These auto-rotate daily and can be removed without service interruption:

# As grid user — example for ASM listener
cd /u01/app/grid/diag/tnslsnr/$(hostname)/asmnet1lsnr_asm/alert
find . -type f -name "log_*.xml" -mtime +7 -delete

Plain-text .log files (requires graceful rotation): Because the listener writes continuously to this file, direct deletion risks data loss or corruption. Instead, disable logging, rotate the file, then re-enable:

# Step 1: Disable logging via LSNRCTL
lsnrctl
LSNRCTL> set current_listener asmnet1lsnr_asm
LSNRCTL> set log_status off

# Step 2: In a separate terminal, rename the active log
cd /u01/app/grid/diag/tnslsnr/$(hostname)/asmnet1lsnr_asm/trace
mv asmnet1lsnr_asm.log asmnet1lsnr_asm.log.$(date +%Y%m%d)

# Step 3: Re-enable logging
LSNRCTL> set log_status on

Repeat the above process for each listener (e.g., LISTENER, LISTENER_SCAN1, MGMTLSNR). After confirmation that new entries appear in the freshly created asmnet1lsnr_asm.log, the archived .log file may be compressed or removed.

All operation must be executed independently on every RAC node.

Tags: oracle-rac log-management disk-space audit-logs trace-files

Posted on Wed, 23 Sep 2026 16:50:27 +0000 by nilansanjaya