Database recovery
Database recovery implies restoring your
database from a backup and logs if you just restore from a backup you would be
reacting the database as it existed at the time the backup was taken if archive
logging enabled before the backup you can not using restore only using a backup
image but also from the logs a roll forward recovery allow you to restore from a
backup and then apply roll forward the log to the end of the log or to a
specific point in time.
Recovery types
There are three type of recovery
restart or crash recovery
Assume you are working on a desktop computer
running important transactions to a DB2 database suddenly there is a power
outage or someone accidentally to a db2 database suddenly there is a power
outage or some one accidentally unplug the power code next time you start your
computer and start DB2 crash recovery will automatically be executed in crash
recovery DB2 will automatically run the command restart database and will read
the transaction based on the active logs when this command completes you are
guarantied that your database will be in a consistent state that is whatever as
committed will be saved and what ever was not committed will be rolled back.
image and version recovery
This type of recovery implies that you are
restoring only from a backup image therefor your database would be put in the
state it was at the time the backup was taken. any transactions performed on the
database after backup was taken would be lost.
Roll forward recovery
this type of recovery you not only restore from
a backup image but you also the roll forward command to apply the logs on top of
the backup so that you can recover to a specified point in time ,this type of
recovery minimize data loss.
Database restore
Database restore command recover a database
from a backup image following syntax is the simplest that can be used for this
command.
RESTORE DATABASE <dbname> from <path> taken at
<timestamp>