In: Computer Science
Database Design - Recovery
Choose a database recovery problem and then propose a solution using the techniques such as Log-based recovery, shallow paging, etc.
Briefly describe the technique, when it is appropriate to use and what recovery problem it solves.
Like any other computer system, databases are also subject to failures but the data stored in it must be available as and when required. It facilities for fast recovery. It also has the property of atomicity which means either transaction is completed successfully or the transaction should have no effect on the database.
Log-based recovery
Log-based recovery works as follows −
The log file is kept on a stable storage media.Log is used to maintain records of actions performed by a transaction. It contains information about the start and end of each transaction and also contains any updates which occur in the transaction.
When a transaction enters the system and starts execution, it writes a log about it.
<Tn, Start>
When the transaction modifies an item X, it writes logs as;
<Tn, A, B, C>
It reads Tn has changed the value of A, from B to C.
<Tn, commit>
The techniques used to recover the lost data due to system crash, transaction errors, viruses, catastrophic failure, incorrect commands execution, etc.