What linux program to use to compress DB2 log files with the best compression ratio?


I thought that these log files would be text type files. But viewing them didn't prove this. I tried to use gzip and zip with up to 88% compression ratio. Which is pretty good.

Still my question is valid. Is there any 'recommended' program to compress DB2 log files?

UPDATE2 - results of my own comparision using maximum/best compression

 5.1M  7zip.mx9.7zip
 7.0M  tarbzip2.bzip2
 8.8M  targzip.tgz
 8.8M  zip.zip

when compressing two files

41M S0045979.LOG
29M S0045980.LOG
  • You could also trying this question on StackExchange's ServerFault.com
    – WarrenT
    Sep 13, 2012 at 0:58
  • Have you tried bzip2 ?
    – Philᵀᴹ
    Sep 13, 2012 at 1:55
  • @Phil: I added results for bzip2
    – Radek
    Sep 13, 2012 at 2:11
  • 1
    A point to note...make sure that you can still use the logs for restoring/rollforward after you decompress them. I have heard of cases of compressing messing up the log files. As a note, in our case we package our logs in all our online backups and we use DB2's internal compression to compress the backup file. Sep 13, 2012 at 12:42
  • We need to move/compress temporarily the log files to make some space on hdd. I hope this won't mess up creation of any kind of backup.
    – Radek
    Sep 14, 2012 at 1:37

1 Answer 1


In version 10.1, the logs are internally compressed, that means that more information is stored in those files.

But if you want to compress them in order to use less space in your disks, I do not see this like a very good practice, because logs are the only part where the latest data is stored in, and if you want to do a restore, you will have to use the log files, to restore the database with an extra process, and probably, to perform a restore you will need even more space than before (the compressed file + the expanded file).

Presonally, this compress operation adds "noise" to the disaster recovery strategy, how are you going to check if a compressed file is ok or not?

Finally, if you want to do a thing like this, you could use the userexit option in order to implement your own process to take the online logs and pass them as offline logs. In this process you could compress and extract the files.

BTW, why don't you use circular logs? Any enterprise knows the importance of archive logs.

  • It was 'just' temporary solution to save some disk space when the server was running out of the space. New hw is ordered so it's ok now. Still wanted to know more about this topic so I created the question.
    – Radek
    Sep 24, 2012 at 4:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.