Question & Answer
Question
Why can't transaction log files be removed with 'db2 prune history' command in case that 'LOGARCHMETH1' is 'LOGRETAIN' ?
Answer
Log files in transaction log path cannot be removed with 'db2 prune history <timestamp> and delete' command if database configuration 'LOGARCHMETH1' is set to 'LOGRETAIN'.
This is because 'db2 prune history' command works based on the 'db2 history' information.
With 'LOGRETAIN' option, DB2 maintains inactive log files in the active log path and these log files are not archived to other path.
The archive log history can be checked with following command.
Output:
$ db2 list history archive log all for sample
List History File for sample
Number of matching file entries = 0
For removing the log files with 'db2 prune' command, it is necessary to set 'LOGARCHMETH1' parameter as specific path.
Following is the example of DB configuration and removing log files in the archive directory with 'db2 prune' command
Output :
$ db2 update db cfg for sample using LOGARCHMETH1 DISK:/database/archive
$ ls -tlr | sort -k 9
total 307136
-rw-r----- 1 junsulee build 40968192 May 12 19:07 S0000001.LOG
-rw-r----- 1 junsulee build 13017088 May 12 19:07 S0000002.LOG
-rw-r----- 1 junsulee build 40968192 May 12 19:07 S0000003.LOG
-rw-r----- 1 junsulee build 13201408 May 12 19:24 S0000004.LOG
-rw-r----- 1 junsulee build 37089280 May 06 00:45 S0000005.LOG
-rw-r----- 1 junsulee build 11993088 May 12 17:51 S0000006.LOG
$ db2 prune history 20140512190735 and delete
DB20000I The PRUNE command completed successfully.
$ ls -tlr | sort -k 9
total 201688
-rw-r----- 1 junsulee build 40968192 May 12 19:07 S0000003.LOG
-rw-r----- 1 junsulee build 13201408 May 12 19:24 S0000004.LOG
-rw-r----- 1 junsulee build 37089280 May 06 00:45 S0000005.LOG
-rw-r----- 1 junsulee build 11993088 May 12 17:51 S0000006.LOG
Related Information
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21673776