1

Is there a way to know what are the necessary log files for specific backup?

Un example of backup and restore process:

db2 BACKUP DATABASE TST1 ONLINE TO '/db2/backup'
db2 RESTORE DATABASE TST1 FROM '/db2/backup' TAKEN AT 20150826131633 TO '/db2/data' INTO TST2

db2 rollforward db TST2 to end of logs
db2 rollforward db TST2 complete

Now, in order to be able to rollfoward to end of logs I need to copy the logs from the backuped DB to the target archive dir. What I do is coping the last 2 days and it always passed. Some day it will not.

So how can I know during backup time(right after it) what files exactly in addition I need to backup..?

1

By default an online backup places the logs necessary to rollforward to the point of the end of the backup inside of the backup file. You can extract the logs from the backup file and then ROLLFORWARD to the end of them. Use the LOGTARGET clause of the RESTORE command to extract the logs to a location (I have tended to restore them to a location other than my logs directory.) Then use the OVERFLOW LOG PATH clause of the ROLLFORWARD command to point the ROLLFORWARD command to the logs you just extracted.

Example:

db2 RESTORE DATABASE TST1 FROM '/db2/backup' TAKEN AT 20150826131633 TO '/db2/data' INTO TST2 LOGTARGET '/tmp/extractedlogs'

db2 ROLLFORWARD db TST2 TO END OF LOGS AND COMPLETE OVERFLOW LOG PATH ('/tmp/extractedlogs')
-3

In history file you find first log needed. Rollforward query status should indicate this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.