Posts Tagged ‘LOGPRIMARY’

DB2 transaction logging

February 15, 2012

By default DB2 database uses circular logging. That means you have fixed number of log files which are used circularly. And each time previous file is full next file is erased and reused. It is normal for data warehousing or OLAP where you have fixed data set and only select data from it. In case of failure there are specific restore procedures which simply involves loading of this fixed data set back again. If you work on an OLTP database you have to use archival logging. Otherwise you won’t be able to restore your database to particular point in time if failure occurs. To configure archival logging you need to change several database configuration parameters:

  • LOGRETAIN – change it to Recovery if you want to switch to archival logging
  • LOGARCHMETH1 – point to directory where your log files will be kept

Some other useful parameters:

  • LOGPATH – points to your so called “active logs”. Database use them for immediate recovery needs and they aren’t meant to be used for roll-forward recovery.
  • LOGPRIMARY – number of log files that will be used for active logs
  • LOGFILSIZ – size of each log file

You can find more information here in detail and here in short.

Advertisement