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]
-
When choosing a value for logprimary and/or logsecond, please take into consideration the total resource requirement of all the databases in the instance. See Database Manager Limits for the maximum number of open files.
- 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 active 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.
If circular logging is configured, then the sum of the number of primary and secondary log files must be less than or equal to 256, i.e., (logprimary + logsecond) <= 256.
If archive logging is configured, then the sum of the number of primary and secondary log files must be less than or equal to 8192, i.e., (logprimary + logsecond) <= 8192.
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.
- 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)