IBM Support

DB2 : How do I recover database to a point-in-time if rollforward command fails with SQL1274N ?

Troubleshooting


Problem

When you need to recover a database, sometimes you see problems with the log files or log/data corruptions. So to recover such databases as much as possible and to have minimal data loss, it is recommended to give a point-in-time option in rollforward where this point-in-time is just before the failing time in log files. To recover database, sometimes you try to use various options with the rollforward command and on trying point-in-time you get a SQL1274N error.

Cause

Rollforward commands fail with SQL1274N.

Diagnosing The Problem

When you execute a rollforward command to recover database to a point-in-time using command similar to the one below :

db2 rollforward db <database-name> to 2016-11-23-18.06.51.238895

it returns the following error :

SQL1274N  The database "<database-name>" requires roll-forward recovery and the point-in-time must be to the end of log

This error is expected in such cases since earlier i.e. before using the point-in-time option you must have tried a rollforward on this database till end-of-logs (which is considered to be still in progress). So internally stoptime and log replay was set to "end-of-logs". So now you cannot mention a point-in-time which is earlier than the first stoptime (end-of-logs) mentioned.

So ideally you should next try to rollforward database to end-of-logs as follows :

db2 rollforward db <database-name> to end of logs

But as the problem at hand is a log corruption or log file problem (missing, partial etc), end-of-logs is not an option and you want to recover database only upto a time before the failure/corruption.

Resolving The Problem


The solution in such cases is to :

- RESTORE the database again using same backup image as before.
- Then rollforward to the point-in-time i.e. use following RF command :
  db2 rollforward db <database-name> to 2016-11-23-18.06.51.238895
- Once this is successful, run the command :
db2 rollforward db <database-name> stop

This should get the database in connectable and working state salvaging maximum possible data.

[{"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"--","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.8;9.7;10.1;10.5;11.1","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21996478