Transaction Recovery in DBMS
A single DBMS operation such as updation, insertion, selection or deletion is not a simple task but involves many tasks. For example, in the EMPLOYEE table, update the designation of an employee from MANAGER to ANALYST following the operations that need to be performed.
1. Locating the required record in the secondary storage medium such as a hard disk.
2. Copying the record to primary memory.
3. Performing the required updation.
4. If successful, perform commit action, else perform rollback action.
The above figure shows the task diagrammatically.
Thus, the updation, insertion or deletion operation requires several distinct tasks or steps to be performed by the DBMS. Such a collection of tasks or steps for execution of a single database operation (like insertion, updation, deletion, etc) is called a Transaction.
A transaction is a program unit whose execution may or may not change the contents of a database. The transaction is executed as a single unit. If the database was in a consistent state before a transaction. Then after the execution of the transaction also, the database must be in a consistent state. Once committed a database can’t be rolled back.
A transaction can be terminated in three ways, these are:
1. Suicidal Termination: The transaction detects an error while processing and decides to terminate itself by performing a rollback operation.
2. Murderous Termination: The database management software or the operating system can force the transaction to be terminated due to some specified reasons.
3. Successful Termination: The transaction is terminated after executing it successfully.