Using RECOVER command inspite of RESTORE and ROLLFORWARD command
Simplified Restore and Rollforward Command
For those that have been using
DB2 for some time or those coming from other data servers, you are
likely familiar with the RESTORE command. With RESTORE, you specify the
backup
image you want to restore (indicated by the timestamp the backup was
TAKEN AT) the media you are restoring from and the database name you
are restoring to. Then if you want to roll the database forward to end
of logs or a point in time you follow the restore with a ROLLFORWARD
command.
What many may not be aware of is that in V8 there was a
simplification of this process. The RECOVER command not only combines
the above two steps into a single step but it also focuses on what you
want to accomplish rather than how to accomplish that task. What I mean
by this is you simply specify at what point in time you want the database to be at after the recovery and DB2 figures out the best way to get you there.
For example if you simply want to get the database back to the end of the log files that exist you simply run
db2 RECOVER DATABASE db_name TO END OF LOGS
db2 RECOVER DATABASE sample to end of logs
Rollforward Status
Input database alias = sample
Number of nodes have returned status = 1
Node number = 0
Rollforward status = not pending
Next log file to be read =
Log files processed = S0000002.LOG - S0000011.LOG
Last committed transaction = 2008-04-22-13.14.25.000000
DB20000I The RECOVER DATABASE command completed successfully.
That's all you need to do. DB2 will look at the recovery
history file for the database name specified, find out where the most
recent backup has been written to (Disk, TSM, other vendor backup
management software, etc) and then automatically invoke the restore
command with the proper parameters for the time taken and source media.
Then when the restore completes it automatically invokes the roll
forward command to take you to the end of logs. At a time when you need
to perform a recovery of the database, that's typically not the time
when you want to have to deal with any added complexity so
simplification of recovery processing sure is a nice thing.
Some other nice features with the RECOVER command:
Source: ITtoolbox Blogs