Databases Reference
In-Depth Information
Forward Recovery
First let's consider a calamity that destroys a disk, or an only slightly lesser calamity
that destroys a database or a particular database table. The disk or the database or the
table has to be recreated and the recovery procedure in this case is called '' forward
recovery '' or '' roll-forward recovery'' (the word ''roll'' in ''roll forward'' comes
from the earlier use of tapes to record the logs). Let's look at this by considering a
lost table. To recreate the lost table, you begin by readying the last backup copy of
the table that was made and readying the log with all of the changes made to the
table since the last backup copy was made. The point is that the last backup copy
is, well, a copy of the table that was lost, which is what you want, except that it
doesn't include the changes to the data that were made since the backup copy was
made. To fix this, a ''recovery program'' begins by reading the first log entry that
was recorded after the last backup copy was made. In other words, it looks at the
first change that was made to the table right after the backup copy was made. The
recovery program updates the backup copy of the table with this log entry. Then,
having gone back to the beginning of the log, it continues rolling forward ,making
every update to the backup copy of the table in the same order in which they were
originally made to the database table itself. When this process is completed, the lost
table has been rebuilt or recovered, Figure 11.4! This process can be performed with
either a change log or a transaction log. Using the change log, the ''after images''
are applied to the backup copy of the database. Using the transaction log, the actual
programs that updated the database are rerun. This tends to be a simpler but slower
process.
One variation of the forward recovery process when a change log is used is
based on the recognition that several changes may have been made to the same
piece of data since the last backup copy of the table was made. If that's the case,
then only the last of the changes to the particular piece of data, which after all shows
the value of this piece of data at the time the table was destroyed, needs to be used
in updating the database copy in the roll-forward operation.
Last
database
backup
copy
Roll
forward
program
Recreated
database
Log
(starting with
first change
to the database
after the last
backup copy
was made)
F IGURE 11.4
Forward recovery
Search WWH ::




Custom Search