Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

when compressing two files

41M S0045979.LOG
29M S0045980.LOG
share|improve this question
You could also trying this question on StackExchange's – WarrenT Sep 13 '12 at 0:58
Have you tried bzip2 ? – Phil Sep 13 '12 at 1:55
@Phil: I added results for bzip2 – Radek Sep 13 '12 at 2:11
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. – Chris Aldrich Sep 13 '12 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 '12 at 1:37

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.

share|improve this answer
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 '12 at 4:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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