DB2 – How to Purge Old Online Backups and Archive Logs

archivedb2db2-9.7

DB is in Archive Mode.
We are creating full Online Backups every night at 23:00.
We set automatic removal of old online backups and archive logs.

AUTO_DEL_REC_OBJ ON
NUM_DB_BACKUPS   2
REC_HIS_RETENTN  2

In backup folder we have two online backups and that is ok:

Backup1 22.02 23:00
Backup2 23.02 23:00

In the archive logs folder we have these logs:

from S0000047.LOG to S0000057.LOG (from 22.02 23:00 to the 23.02 22:41)
from S0000058.LOG to S0000062.LOG (from 23.02 23:00 to this morning 24.02)

Those are OK logs of course.
But I noticed that we have also archive logs which should not be there (logs after the backup of 21.02 which is already deleted and all those transactions are already contained within the backup of 22.02). But we have archive logs

from S0000037.LOG to S0000046.LOG (from 22.02 01:41 to the 22.02 22:42)

So those are unnecessary logs.
On some other system (server) for some other customer we have also enabled this purging but there we have regular situation – only backups and archive logs after those backups are kept, there are no previous archive logs, but on this system it seems like deletion of all archive logs is late to 1 day.

Why is that I really think this is not regular situation (as I said also based on experience on some other server)

Best Answer

You can always clean them up manually or use a script to clean them up (maybe looking for files older than seven days or something).