Space requirements for log files
Space requirements for log files vary depending on your needs and on configuration parameter settings.
- (logprimary + logsecond) × (logfilsiz + 2) × 4096
logprimary
is the number of primary log files, defined in the database configuration filelogsecond
is the number of secondary log files, defined in the database configuration file; in this calculation,logsecond
cannot be set to -1. (Whenlogsecond
is set to -1, you are requesting an infinite active log space.)logfilsiz
is the number of pages in each log file, defined in the database configuration file- 2 is the number of header pages required for each log file
- 4096 is the number of bytes in one page.
This calculation provides a general guideline for planning required disk space for log files. However, you must ensure to provide sufficient disk space for potential log archiving failures if the selected log archiving method fails. This might result in log file retention until those log files are successfully archived. Therefore, depending on the rate at which your transactions fill the log files and the time it takes you to notice a log archiving failure, a number of log files might be retained and occupy a large amount of the available disk space. Db2® processes might keep a few extra archived log files in the log path for performance reasons. Therefore, you might see more log files in the log path than you expected.
- Rollforward recovery
- If the database is enabled for rollforward recovery, special log
space requirements might be considered:
- With the logarchmeth1 configuration parameter set to LOGRETAIN, the log files are archived in the log path directory. The online disk space eventually fills up, unless you move the log files to a different location.
- With the logarchmeth1 configuration parameter
set to USEREXIT, DISK, or VENDOR,
a user exit program moves the archived log files to a different location.
Extra log space is still required to allow for:
- Online archived log files that are waiting to be moved by the user exit program
- New log files being formatted for future use
- You can reduce the cost of storing
your archived log files if you enable compression on these files.
- For example, if the logarchmeth1 configuration parameter is set to DISK, TSM, or VENDOR, and you set the logarchcompr1 configuration parameter to ON, archived log files are compressed and you reduce the cost of storing these files. If you enable compression dynamically, existing archived log files already stored are not compressed. Compression starts with the current active log file when compression is enabled.
- Circular logging
- If the database is enabled for circular logging, the result of this formula is all the space is allocated for logging; that is, more space is not allocated, and you do not receive insufficient disk space errors for any of your log files.
- Infinite logging
- If the database is enabled for infinite logging (that is, you set the logsecond configuration parameter to -1), the logarchmeth1 configuration parameter must be set to a value other than OFF or logretain to enable archive logging. The database manager keeps at least the number of active log files specified by the logprimary configuration parameter in the log path, therefore, you must not use the value of -1 for the logsecond configuration parameter in the formula shown previously. Ensure that you provide extra disk space to allow for the delay caused by archiving log files.
- Mirroring log paths
- If you are mirroring the log path, you must double the estimated log file space requirements.
- Currently committed
- If queries return the currently committed value of the data, more
log space is required for logging the first update of a data row during
a transaction when the cur_commit configuration
parameter is not set to DISABLED. Depending on the
size of the workload, the total log space used can vary significantly.
This scenario affects the log I/O required for any workload, the amount
of active log space required, and the amount of log archive space
required. Note: Setting the cur_commit configuration parameter to DISABLED, maintains the same behavior as in previous releases, and results in no changes to the log space required.