Compressing archive logs

Archive logs are critical files required for database recovery. In a busy online transaction processing (OLTP) database, several gigabytes of archive logs are generated each day. Company guidelines often mandate preserving archive logs for several days. The Oracle archive logs are read-only files and are never updated after they are generated. During recovery, Oracle reads archive logs sequentially. As such, archive logs are very good candidates for compression, and archive logs are highly compressible.

The following example procedure compresses all archive logs that are older than a day.

To compress all archive logs that are older than a day

  1. As an Oracle DBA, run the following query and get the archive log location:
    $ SQL> select destination from v$archive_dest where status = 'VALID'
    and valid_now = 'YES';

    Assume /oraarch/MYDB is the archive log destination.

  2. Compress all of the archive logs that are older than a day:
    $ find /oraarch/MYDB -mtime +1 -exec /opt/VRTS/bin/vxcompress {} \;

    You can run this step daily via a scheduler, such as cron.