Tuesday, 13 September 2016

Recovery of a Database

Database is design and created very carefully but in fact the database is damage and destroyed, regardless of concurrency controls and recovery technique are used. The techniques of data recovery and concurrency control are important to protect data from loss. 
What is database recovery??? What is concurrency control??? 
Database recovery means that, in the case of a database failure to restore the database to a correct state.
To manage a simultaneous process without interfering with one another that involved a database in the process is called a concurrency control.
The question is rise in every person mind why we need a recovery technique???
Before the answer of this question we must determine the causes of failure. 
Carelessness by user, disks malfunctions, the loss of main memory and cache memory, destruction of the database management system due to software errors, applications software errors, intentionally destroyed the data, hardware, software facilities. These are the causes of the database failure. 
So to minimize the effect of these failures the recovery techniques is used because database is very important for any organization.
Different ways for database recovery is used but two techniques are mostly used. 
Recovery by reprocessing:-
                                             Take a regular backup of a database to recover data. In reprocessing all event that were done earlier must be redo similar to the way as it were done first time.
 What is redo??? 
The redo list contains the most recent transactions for a record. If database is failed then backup of the database can be restored the transaction can be reprocessed that is after the last backup. The time of reprocessing is equal to the time that the transaction takes first time. Transaction when processed concurrently then human activity may change the order of execution of different activities.
Recovery by Rollback/ Roll forward:-
                                                                    In this technique log file is created to recover the database. The purpose of log file is to keep all the changes before these change are applied to the database. In the case of system failure the log file is used to reapply all the changes to the database.
In this technique if data is lost then rollback and Roll forward method is used to recover database but in these two method log file is required. 
In rollback method all changes made by transactions must be undo.
What is undo??? 
Undo is a list to contain the earliest transaction for a record. 
All the transaction must be restored that were in process at the time of system failure and incomplete transaction must be checked before all the changes are applied in the database. 
If complete database is corrupted then Roll forward method is suitable to recover from last backup. 

In Rollback and Roll forward checkpoint is used. Checkpoint indicated the time when database and transaction were synchronized. In database recovery transaction need to be apply after the last checkpoint. 

No comments:

Post a Comment