Crash Recovery and Backup for Computer Science and MCA students
Explain Log-band recovery technique in detail.
In multiprogramming system, hundreds of transactions being executed every second. For many reasons these transaction may fail such as
- Transaction failure
- System Crash
- Disk Failure
DBMS has very strong recovery technique for system or transaction failure. There are two main techniques for recovery of these type of transaction failure.
- DBMS maintains the logs of each transaction, and writes some stable storage before actually modifying the database.
- It maintains shadow paging, where the changes are write on a volatile memory, and later, the actual database is updated.
Log is a type of buffer which maintains the records that is performed by a transaction. Log contains Start of transaction, trans-id, record-id, type of operation (insert, update, delete), old value, new value, End of transaction that is commit or aborted.
Log-based recovery works as follows- When a transaction starts execution, it writes a log about it in log file.
- When the transaction modifies an item, it writes in logs.
- When the transaction finishes, it writes in log file.
The database can be modified using two approaches
Deferred update techniques
It does not physically update the database on disk until after a transaction reaches its commit point. Before reaching the commit point, all transaction updates are recorded in thelocal buffers. At the time of commit operation, the updates are first recorded in the log and then written to the Database.
If a transaction fails before reaching its commit operation, there is no need to UNDO, because it has not changed the database.
Immediate update techniques
If a transaction fails before reaching commit point, it must be rolled back by undoing the effect of its operations.It is also required to redo the effect of the committed transactions. It is also known as UNDO/REDO algorithm.