You are on page 1of 11

DATABASE

ADMINISTRATION
BSC 301.
GROUP NO 1.
Database recovery.

Restores a database from a given state (usually inconsistent) to a


previously consistent state. Recovery techniques are based on the
atomic transaction property: all portions of the transaction must be
treated as a single, logical unit of work in which all operations are
applied and completed to produce a consistent database.
Database recovery cont…

•If, for some reason, any transaction operation cannot be completed, the
transaction must be aborted and any changes to the database must be rolled
back (undone). In short, transaction recovery reverses all of the changes that
the transaction made to the database before the transaction was aborted.
Recovery concept and techniques also apply to the overall database and to the
system after some type of critical error has occurred. Critical events can cause a
database to become non-operational and compromise the integrity of the data.
Types of recovery.
i. Backward recovery or undo.
ii. Forward recovery.
Backward recovery or UNDO.
• With backward recovery (also called rollback), the DBMS backs out
of or undoes unwanted changes to the database. As a result, the
database is returned to an earlier state; the unwanted changes are
eliminated. Backward recovery is used to reverse the changes made by
transactions that have aborted, or terminated abnormally.
Backward recovery example…
•For example, suppose that a banking transaction will transfer Tsh. 1000 in funds from the account for customer
A to the account for customer B. The following steps are performed:

i. The program reads the record for customer A and subtracts Tsh 1000 from the account balance.
ii. The program then reads the record for customer B and adds Tsh 1000 to the account balance.

•Now the program writes the updated record for customer A to the database. However, in attempting to write the
record for customer B, the program encounters an error condition (e.g., a disk fault) and cannot write the record.
Now the database is inconsistent record A has been updated but record B has not and the transaction must be
aborted. An UNDO command will cause the recovery manager to apply the before image for record A to restore
the account balance to its original value. (The recovery manager may then restart the transaction and make
another attempt.)
Forward recovery.
With forward recovery (also called rollforward), the DBMS starts with an
earlier copy of the database. Forward recovery is much faster and more
accurate than restore/rerun, for the following reasons:
The time-consuming logic of reprocessing each transaction does not have to
be repeated.
Only the most recent after images need to be applied. A database record may
have a series of after images (as a result of a sequence of updates), but only
the most recent, “good” after image is required for rollforward.
With rollforward, the problem of different sequencing of transactions is
avoided, because the results of applying the transactions (rather than the
transactions themselves) are used
Types of database failure.
i. Aborted transaction.
ii. Hardware and software failure.
iii. Human caused incidents.
i. Intentional incidents.
ii. Unintentional incidents.
iv. Database destruction.
v. System failure.
vi. Natural disaster.
Basic database management system
recovery facilities.
i. Backup facilities.
ii. Journalizing facilities.
iii. Checkpoint facilities.
Recovery Manager.

The recovery manager is a module of a DBMS that restores the database


to a correct condition when a failure occurs and then resumes
processing user requests. The type of restart used depends on the nature
of the failure. The recovery manager uses the logs as well as the backup
copy, if necessary to restore the database.
Database recovery strategy.
i. Multiple tier data storage.
ii. Testing.

You might also like