IBM Support

[Db2] When will transaction log files get archived ?

Question & Answer


Question

When will transaction log files get archived ?

Answer

The term "archive" can be used to explain two different behaviours in Db2.

1) Closure of the transaction log file
2) Copying of transaction log file from active log path to archive log path

Here we will explain the timing of the archival for both cases.

1) Closure of the transaction log file
Transaction log will be closed at the following timings:
  • log file becomes full (a log file reaches LOGFILSIZ)
  • database is deactivated (Note 1)
  • one of followings are explicitly performed
    • online backup
    • ARCHIVE LOG command (Note 2)
    • SET WRITE SUSPEND command

2) Copying of transaction log file from active log path to archive log path
The transaction log will become the target of the copying after the log file is closed. The copy operation will be run asynchronously,  thus it may not occur immediately after the file is closed.

Note 1:
Database will be deactivated after either of the following:
  • DEACTIVATE DATABASE command is issued (if the database was explicitly activated by ACTIVATE DATABASE command)
  • All the database connections are disconnected (if the database was implicitly activated by first connection request)

Note 2:
The ARCHIVE LOG command does not copy the log file to the archive log path; it just closes the file. The actual copying occurs asynchronously.
Additional tips
  • DO NOT delete log files in active log path even if you see the same file in the archive log path. The log file in active log path can still be an active log and is required to complete crash recovery.
    Before deleting log files in active log path, verify the "First active log" database configuration parameter value. The value indicates the oldest log file required for possible crash recovery at that time. If you need to delete log files in active log file, make sure the files are older than "First active log".
  • After the file is successfully copied to archive log path and is no longer an active log, the log file can be renamed and reused when the database needs a new active log file.

Related information
Log file management
Log file management through log archiving
 

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Component":"OTHER - Uncategorised","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.7;9.5;10.1;10.5;11.1;11.5","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
03 December 2019

UID

ibm11088878