HOW TO clear inactive DB2 LUW transaction log files

21 September,2016 by Tom Collins

How to clear inactive DB2 LUW transaction log files is a solution to a common problem. Before we discuss how to prune the inactive transaction logs we’ll need to establish which log files are inactive.

It is important to identify which logs to delete. If you delete an active transaction log file, you will cause an outage on the database

Note: Log files located in the  transaction log path cannot be removed with 'db2 prune history xxxxxxx and delet'  if database configuration 'LOGARCHMETH1' is set to 'LOGRETAIN'. 

Before you start any activity , speak to the owners and users of the database . It is safer to stop the applications. It is not always possible - as it may be a live online database. Also consider create a backup for recovery . Completing a DB2 online backup won't force any applications

Follow the steps below to clear the DB2 LUW transaction log files.

>>Connect to the database using the command

su - db2usr1

$db2 connect to myDB

>>Connect to the database configuration details using either of these methods

$db2 get db config

db2 get db config | grep "log”

>>Search for the First active log file database parameter. For example:

First active log file = S0130573.LOG

>>Once you define the active log file execute

$db2 prune logfile prior to <activeLogFileName>

>>Applying this example to our command:

$db2 prune logfile prior to S0130573.LOG

 >>On execution of this command, DB2 would clear all inactive transaction logs prior to S0130573.LOG


Read More

Log files are not removed with 'db2 prune history' command

DB2 – Restore database from a ONLINE backup (DBA DB2)

DB2 SQL2413N - Online backup is not allowed (DBA DB2)


Author: Rambler(


Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment on HOW TO clear inactive DB2 LUW transaction log files

Comments are moderated, and will not appear until the author has approved them. | DB2 Performance Tuning | DBA DB2:Everything | FAQ | Contact | Copyright