DB2 ROLLFORWARD – Does ‘TO END OF LOGS’ Read Archive Logs?

backupdb2logsrestoretransaction-log

I read about ROLLFORWARD option on link http://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001978.html?cp=SSEPGG_9.7.0%2F3-6-2-4-106 but I could not find answer to my issue.

I have database in Archive mode.

I am using DISK option in LOGARCHMETH1

I made full ONLINE backup at Monday at 23:59

I have archive logs for Tuesday, Wednesday and Thursday.
Let's say just for example one for each day: S0000001.LOG and S0000002.LOG and S0000003.LOG.

In Friday I have active log S0000004.LOG.

Let's say just for testing purpose I want to do the restore of Online backup made at Monday and all transactions committed during Tuesday, Wednesday,Thursday and Friday. So I want to restore everything from Monday to Friday

I thought by reading all manuals that I just need to perform after restore ROLLFORWARD TO END OF LOGS

db2 rollforward db maxdb75 to end of logs and complete;

I thought that this command to end of logs it will include Archive Logs(S0000001.LOG + S0000002.LOG + S0000003.LOG.)+Active Logs(S0000004.LOG)

But one good database expert told me that: "When rolling forward to end of logs without specifying overflow log path only active logs will be read"

So I have 2 questions:

  1. What in my example will be restored in case of "to end of logs" command
  2. Is this the command if after the restore I want to rollforward everything from Monday To Friday in my exampe: db2 rollforward db maxdb75 to end of logs and complete overflow log path "(/data/archiveLogsPath)";

Thank you in advance!!!!

Best Answer

Whoever told you "When rolling forward to end of logs without specifying overflow log path only active logs will be read" was wrong.

When you have LOGARCHMETH1 set to DISK, TSM, USEREXIT or VENDOR, the DB2 log manager EDU (db2logmgr) is responsible for moving log files to and from the archive location. When performing a ROLLFORWARD operation, DB2 will determine which log files it needs, and db2logmgr will retrieve files for processing if they aren't already in the active log path.

Now, if you have LOGARCHMETH1 set to LOGRETAIN, and you are manually moving log files from the active log path to somewhere else, only then will you have to specify OVERFLOW LOG PATH (or move/copy the transaction log files back to the active log path).

So: to end of logs means just what it sounds like: DB2 will replay all transactions present in log files between the backup time and when the restore took place.