DB2 10.5 for Linux, UNIX, and Windows

logprimary - Number of primary log files configuration parameter

This parameter allows you to specify the number of primary log files to be preallocated. The primary log files establish a fixed amount of storage allocated to the recovery log files.

Configuration type
Database
Parameter type
Configurable
Default [range]
3 [ 2 - 256 ]
Note: The default value is subject to change by the DB2® Configuration Advisor after initial database creation.
Unit of measure
Counter
When allocated
  • The database is created
  • A log is moved to a different location (which occurs when the newlogpath parameter is updated)
  • When the first log record is written after the database is next started following an increase in the value of this parameter (logprimary), provided that the database is not started as an HADR standby database
  • A log file becomes inactive and a new log file is required to keep at least logprimary logs in the primary log path (the logarchmeth1 or logarchmeth2 parameter must not be set to a value other than OFF).
  • If the logfilsiz parameter has been changed, the log files are re-sized during the next database startup, provided that it is not started as an HADR standby database
When freed
Not freed unless this parameter decreases. If decreased, unneeded log files are deleted during the next connection to the database.

Under circular logging, the primary logs are used repeatedly in sequence. That is, when a log is full, the next primary log in the sequence is used if it is available. A log is considered available if all units of work with log records in it have been committed or rolled-back. If the next primary log in sequence is not available, then a secondary log is allocated and used. Additional secondary logs are allocated and used until the next primary log in the sequence becomes available or the limit imposed by the logsecond parameter is reached. These secondary log files are dynamically deallocated as they are no longer needed by the database manager.

The number of primary and secondary log files must comply with the following:
  • If logsecond has a value of -1, logprimary <= 256.
  • If logsecond does not have a value of -1, (logprimary + logsecond) <= 256.

Recommendation: The value chosen for this parameter depends on a number of factors, including the type of logging being used, the size of the log files, and the type of processing environment (for example, length of transactions and frequency of commits).

Increasing this value will increase the disk requirements for the logs because the primary log files are preallocated during the very first connection to the database.

If you find that secondary log files are frequently being allocated, you might be able to improve system performance by increasing the log file size (logfilsiz) or by increasing the number of primary log files.

For databases that are not frequently accessed, in order to save disk storage, set the parameter to 2. For databases enabled for rollforward recovery, set the parameter larger to avoid the additional processing time of allocating new logs almost immediately.

You can use the database system monitor to help you size the primary log files. Observation of the following monitor values over a period of time will aid in better tuning decisions, as average values might be more representative of your ongoing requirements.
  • sec_log_used_top (maximum secondary log space used)
  • tot_log_used_top (maximum total log space used)
  • sec_logs_allocated (secondary logs allocated currently)