Open In App

Recoverability in DBMS

Last Updated : 02 Aug, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Recoverability ensures that after a failure, the database can restore a consistent state by keeping committed changes and undoing uncommitted ones. It uses logs to redo or undo actions, preventing data loss and maintaining integrity.

There are several levels of recoverability that can be supported by a database system:

  • No-Undo Logging: Only saves committed transactions; can't undo uncommitted ones.
  • Undo Logging: Can undo uncommitted transactions but may lose some committed updates.
  • Redo Logging: Can redo committed transactions to ensure durability.
  • Undo-Redo Logging: Supports both undo and redo, ensuring full recovery and consistency.

Overall, recoverability is a crucial property of database systems, as it ensures that data is consistent and durable even in the event of failures or errors. It is important for database administrators to understand the level of recoverability provided by their system and to configure it appropriately to meet their application's requirements.

schedules_types

Recoverable Schedules

A recoverable schedule ensures a transaction commits only after the transactions it depends on have committed. This avoids inconsistencies and helps the database recover correctly after failures.

Example 1:

Consider the following schedule involving two transactions T1 and T2.

T1T2
R(A) 
W(A) 
 W(A)
 R(A)
commit 
 commit

This is a recoverable schedule since T1 commits before T2, that makes the value read by T2 correct.

Example 2:

S1: R1(x), W1(x), R2(x), R1(y), R2(y),W2(x), W1(y), C1, C2;

cascade_3
  • T2 reads uncommitted data from T1 (R2(x) depends on W1(x)), but T2 commits only after T1 commits.
  • The schedule is recoverable.

Read more about Types of Schedule Based on Recoverability.

Irrecoverable Schedules

An irrecoverable schedule occurs when a transaction commits after performing a dirty read—i.e., reading data written by another uncommitted transaction—and the original transaction later fails or is rolled back. This leads to inconsistency, as the committed transaction has used invalid data.

For example, if T2 reads and commits a value written by T1, but T1 later fails, the system cannot undo T2 since it has already committed. This makes the schedule irrecoverable. To avoid this, a transaction should not commit before the transactions it depends on have committed.Recoverabilityofschedules

Recoverable with Cascading Rollback

A recoverable schedule with cascading rollback occurs when a failure in one transaction (Ti) causes other dependent transactions (Tj) to also roll back, but no committed transaction is affected. Since Tj reads data written by Ti and has not yet committed, it can be safely rolled back when Ti fails.

This preserves recoverability, as all dependencies commit in the correct order. Although multiple rollbacks may happen, the database remains consistent. Such a schedule follows the rule: Tj commits only after Ti commits.

Recoverabilityofschedules2

Cascadeless Recoverable Rollback

A cascadeless recoverable schedule is a type of transaction schedule where transactions are both recoverable and free from cascading rollbacks. In this schedule, a transaction (Tj) reads data written by another transaction (Ti) only after Ti has committed.

This ensures that if Ti fails, no other transaction depends on its uncommitted changes, avoiding the need for cascading rollbacks. The schedule maintains consistency and simplifies recovery by preventing dirty reads. The key rule is: Tj reads Ti’s data only after Ti commits, ensuring both recoverability and cascadelessness.

Recoverability3

Capabilities of Recoverability in DBMS

  1. Atomicity: Transactions in a DBMS are atomic, meaning they either complete entirely or are rolled back to their original state in case of a failure. This ensures that the database remains in a consistent state at all times.
  2. Durability: Once a transaction is committed, its changes are permanently saved to the database. Even in the event of a failure, these changes are retained, ensuring the database can be restored to its last consistent state.
  3. Logging: A DBMS maintains a transaction log that records all changes made to the database and the transactions responsible for those changes. In case of a failure, this log is used to recover the database to a consistent state.
  4. Checkpointing: Checkpoints mark a specific point in time where the DBMS saves the current state of the database. This reduces recovery time after a failure, as only the transactions occurring after the last checkpoint need to be rolled back or replayed.
  5. Recovery Manager: The recovery manager is a component of the DBMS responsible for restoring the database to a consistent state after a failure. It uses logs and checkpoints to identify and handle transactions that need to be undone or redone.
  6. Media Recovery: Media recovery deals with recovering the database from storage failures, such as a hard drive crash. This involves restoring the database from backups and using transaction logs to bring it up to date.

Transaction and Concurrency Control | Recoverable and Irrecoverable Schedule in DBMS
Visit Course explore course icon

Similar Reads