Managing the Log and Diagnostic Files on Database Cloud Service

The software components in Oracle Database Cloud Service generate a variety of log and diagnostic files, and not all these files are automatically archived and purged. Thus, managing the identification and removal of these files to avoid running out of file storage space is an important administrative task.

Database deployments that host single-instance databases include the cleandblogs script to simplify this administrative task. This script runs weekly as a crontab job to archive key files and remove old log and diagnostic files. It uses a configuration file named cleandblogs.cfg to determine how long to retain each kind of log or diagnostic file. You can edit this file to change the default retention periods. This file is located at /var/opt/oracle/cleandb/cleandblogs.cfg.

The following table lists the parameters that appear in the cleandblogs.cfg file, providing a description and the default retention period in days for each file type.

Parameter Description and Default Value

AlertRetention

Alert log (alert_instance.log) retention value in days.

Default value in file: 14

ListenerRetention

Listener log (listener.log) retention value in days.

Default value in file: 14

AuditRetentionDB

Database audit (*.aud) retention value in days.

Default value in file: 1

CoreRetention

Core dump/files (*.cmdp*) retention value in days.

Default value in file: 7

TraceRetention

Trace file (*.tr* and *.prf) retention value in days.

Default value in file: 7

longpRetention

Data designated in the Automatic Diagnostic Repository (ADR) as having a long life (the LONGP_POLICY attribute). For information about ADR, see "Automatic Diagnostic Repository (ADR)" in Oracle Database Administrator's Guide for Release 18, 12.2, 12.1 or 11.2.

Default value in file: 30

shortpRetention

Data designated in the Automatic Diagnostic Repository (ADR) as having a short life (the SHORTP_POLICY attribute). For information about ADR, see "Automatic Diagnostic Repository (ADR)" in Oracle Database Administrator's Guide for Release 18, 12.2, 12.1 or 11.2.

Default value in file: 7

obkupLogRetention

obkup log file retention in days.

Default value in file: 30

LogDirRetention

cleandblogs log file retention in days.

Default value in file: 14

Archiving Alert Logs and Listener Logs

When cleaning up alert and listener logs, cleandblogs first archives and compresses the logs, operating as follows:

  1. The current log file is copied to an archive file that ends with a date stamp.

  2. The current log file is emptied.

  3. The archive file is compressed using gzip.

  4. Any existing compressed archive files older than the retention period are deleted.

Running the cleandblogs Script Manually

The cleandblogs script automatically runs weekly, but you can also run the script manually if the need arises.

  1. Connect as the oracle user to the compute node.

    For detailed instructions, see Connecting to a Compute Node Through Secure Shell (SSH).

  2. Change to the directory containing the cleandblogs script:

    $ cd /var/opt/oracle/cleandb
  3. Run the cleandblogs script:

    $ ./cleandblogs.pl

    When running the script manually, you can specify an alternate configuration file to use instead of cleandblogs.cfg by using the --pfile option:

    $ ./cleandblogs.pl --pfile config-file-name
  4. Close your connection to the compute node:

    $ exit