Crash recovery

DEFINITION OF CRASH RECOVERY:

Crash recovery refers to the process of restoring a database to a consistent and usable state after a system crash. This involves rolling back incomplete transactions and completing committed transactions that were still in memory at the time of the crash. The database reaches a point of consistency when it is in a stable and usable state. Recovery becomes necessary after a transaction failure.

CONDITIONS THAT CAN LEAD TO TRANSACTION FAILURE:

  1. Power failure on the machine hosting the database manager and its partitions, causing a system shutdown.
  2. Hardware failure such as memory corruption, disk failure, CPU malfunction, or network failure.
  3. Serious operating system error that results in the database going down.

INTRODUCTION TO ARIES (ALGORITHMS FOR RECOVERY AND ISOLATION EXPLOITING SEMANTICS)

ARIES is a recovery algorithm designed for databases that adopt the no-force, steal approach. It is utilized by various database systems including IBM DB2 and MS SQL Server.

ARIES recovery algorithm is based on three main principles:

  1. Write Ahead Logging: Changes made to database objects are first recorded in a log and then the log is written to stable storage before the corresponding object changes are written to disk.
  2. Redo Repeating History: After a crash, ARIES retraces the actions performed on the database prior to the crash, bringing the system back to its exact state before the crash. It then undoes any transactions that were still active at the time of the crash.
  3. Undo Logging Changes: During the undo phase, changes made to the database while undoing transactions are logged to prevent repetitive actions in case of subsequent restarts.

RECOVERY PROCEDURE AFTER A CRASH

The recovery process involves three phases:

  1. Analysis Phase: In this phase, the necessary information is computed from the log file.
  2. Redo Phase: The redo phase restores the database to the precise state it was in at the time of the crash, including all changes from uncommitted transactions that were in progress.
  3. Undo Phase: The undo phase reverses all uncommitted changes, ensuring the database returns to a consistent state. After the redo phase, the database reflects the exact state at the time of the crash, but the changes from uncommitted transactions must be undone to restore consistency.

OTHER RECOVERY METHODS RELATED TO DATA STRUCTURES

WRITE-AHEAD LOG PROTOCOL

The Write Ahead Logging (WAL) protocol encompasses techniques used to provide atomicity and durability (two of the ACID properties) in database systems. In a WAL system, modifications are recorded in a log before being applied. Typically, both redo and undo information are stored in the log. WAL allows database updates to be centralized.

ATOMICITY

Atomicity is the property of transaction processing where either all operations of a transaction are executed or none of them are executed (all-or-nothing principle).

DURABILITY

Durability is an ACID property that guarantees committed transactions will persist permanently.

LOG

A transaction log, also known as a transaction journal, database log, binary log, or audit trail, records the actions performed by a database management system to ensure ACID properties in the event of crashes or hardware failures. Physically, a log is a file storing updates made to the database, saved in stable storage.

CHECKPOINTING

Checkpointing involves periodically storing a snapshot of the current application state, which can be used for restarting execution in case of failures. A checkpoint record is written into the log at regular intervals when the system writes modified DBMS buffers to the disk. This periodic operation reduces recovery time after a crash.

Checkpoints improve recovery efficiency and control the reuse of primary and secondary log files. In the event of a crash, backup files are employed to restore the database to the point of failure.

MEDIA RECOVERY

Media recovery addresses failures

that occur in the storage media holding the permanent database, particularly disk failures. Traditional media recovery methods involve using archive copies (dumps) of the database and archive logs. Archive copies represent snapshots of the database taken periodically.

The archive log contains log records for all committed changes that have not yet been reflected in the archive copy. In the event of a media failure, the current database can be reconstructed by using the latest archive copy and reapplying all changes in chronological order from the archive log.

Disk organizations such as RAID (redundant arrays of independent disks) provide faster recovery from disk failures by storing data redundantly across multiple disks. However, they do not eliminate the need for archive-based media recovery since they cannot completely eliminate the possibility of data loss, such as when multiple disks fail simultaneously.

Database security: Definition, Risks, Types, Importance and Threats

INDEXES: Clustered, Unclustered , Dense, Sparse indexes

Easy Ways to Insert Pictures, Images, and Page Numbers in Microsoft Word

Step-by-Step Guide: Align Text, Insert Blank Pages, Insert Tables, and Erase Tables

Mastering Microsoft Word: Ways to Format, Copy, Cut, Paste & Apply Effects to Texts

Leave a Comment

Your email address will not be published. Required fields are marked *

Get Fully Funded Scholarships

Free Visa, Free Scholarship Abroad

           Click Here to Apply

Acadlly