The Wayback Machine - https://web.archive.org/web/20240810151718/https://www.geeksforgeeks.org/why-recovery-is-needed-in-dbms/
Open In App

Why recovery is needed in DBMS

Last Updated : 21 Jun, 2023
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report

Basically, whenever a transaction is submitted to a DBMS for execution, the operating system is responsible for making sure or to be confirmed that all the operations which need to be performed in the transaction have been completed successfully and their effect is either recorded in the database or the transaction doesn’t affect the database or any other transactions. 

The DBMS must not permit some operation of the transaction T to be applied to the database while other operations of T are not. This basically may happen if a transaction fails after executing some of its operations but before executing all of them. 

Types of Failures

Failures are basically the inability of the database to perform a transaction or any kind of loss to the database. There are basically the following types of failures that may occur and lead to the failure of the transaction such as:

  • Transaction Failure: It is a type of failure that occurs when a transaction is not able to complete or it is no longer acceptable.
  • System Failure/Crash: A hardware, software, or network error occurs comes under this category this type of failure basically occurs during the execution of the transaction. Hardware failures are basically considered Hardware failures.
  • System Error: Some operation that is performed during the transaction is the reason for this type of error to occur, such as integer or divide by zero. This type of failure is also known as the transaction which may also occur because of erroneous parameter values or because of a logical programming error. In addition to this user may also interrupt the execution during execution which may lead to failure in the transaction.
  • Local Error: This basically happens when we are doing the transaction but certain conditions may occur that may lead to the cancellation of the transaction. This type of error is basically coming under Local error. A simple example of this is that data for the transaction may not be found. When we want to debit money from an insufficient balance account it leads to the cancellation of our request or transaction. And this exception should be programmed in the transaction itself so that it wouldn’t be considered as a failure.
  • Concurrency Control Enforcement: The concurrency control method may decide to abort the transaction, to start again because it basically violates serializability or we can say that several processes are in a deadlock.
  • Disk Failure: This type of failure basically occurs when some disk loses its data because of a read or write malfunction or because of a disk read/write head crash. This may happen during a read /write operation of the transaction.
  • Catastrophe: These are also known as physical problems it basically refers to the endless list of problems that include power failure or air-conditioning failure, fire, theft sabotage overwriting disk or tapes by mistake, and mounting of the wrong tape by the operator.
  • Network Failure: A network failure occurs when there is a disruption in the communication channel between the client and the database server. This can happen due to a variety of reasons, such as hardware failure, software error, or a natural disaster.
  • Deadlock: A deadlock occurs when two or more transactions are waiting for each other to release the locks on the resources they need to proceed. This can cause a transaction to get stuck, and eventually, the system may need to abort one or more of the transactions to resolve the deadlock.
  • Software Bugs: Bugs in the DBMS software can cause unexpected behavior or errors during the execution of a transaction. This can lead to data corruption or loss if not handled properly.
  • Power Outage: A power outage can cause the system to shut down unexpectedly, leading to data loss or corruption if the transactions in progress are not properly handled by the recovery mechanism.
  • Data Corruption: Data corruption can occur due to a variety of reasons, such as hardware failure, software bugs, or network errors. If the corruption is not detected and corrected, it can cause data inconsistencies and affect the overall integrity of the database.

Recovery is an essential feature in Database Management Systems (DBMS) because it ensures that data can be restored to a consistent and correct state in case of failures or errors.

Why Recovery is Required in Database?

Here are some of the reasons why recovery is needed in DBMS.

  • System failures: The DBMS can experience various types of failures, such as hardware failures, software bugs, or power outages, which can lead to data corruption or loss. Recovery mechanisms can help restore the database to a consistent state after such failures.
  • Transaction failures: Transactions can fail due to various reasons, such as network failures, deadlock, or errors in application logic. Recovery mechanisms can help roll back or undo the effects of such failed transactions to ensure data consistency.
  • Human errors: Human errors such as accidental deletion, updating or overwriting data, or incorrect data entry can cause data inconsistencies. Recovery mechanisms can help recover the lost or corrupted data and restore it to the correct state.
  • Security breaches: Security breaches such as hacking or unauthorized access can compromise the integrity of data. Recovery mechanisms can help restore the database to a consistent state and prevent further data breaches.
  • Hardware upgrades: When a DBMS is upgraded to a new hardware system, the migration process can potentially lead to data loss or corruption. Recovery mechanisms can help ensure that the data is successfully migrated and the integrity of the database is maintained.
  • Natural disasters: Natural disasters such as earthquakes, floods, or fires can damage the hardware on which the database is stored, leading to data loss. Recovery mechanisms can help restore the data from backups and minimize the impact of the disaster.
  • Compliance regulations: Many industries have regulations that require businesses to retain data for a certain period of time. Recovery mechanisms can help ensure that the data is available for compliance purposes even if it was deleted or lost accidentally.
  • Data corruption: Data corruption can occur due to various reasons such as hardware failure, software bugs, or viruses. Recovery mechanisms can help restore the database to a consistent state and recover any lost or corrupted data.

Recovery is needed in DBMS to ensure data consistency, integrity, and availability in the face of various types of failures and errors.

FAQs on Recovery

1. What is Recovery and why it is needed?

Answer:

Recovery is basically making the database or rebuilding the database after the problem of failures.

2. What is the objective of the database recovery?

Answer: 

The most basic objective of database recovery is to maintain the integrity of the database.

3. What is the use of backup and recovery in DBMS?

Answer:

Backup and Recovery is basically a way to restore critical data in case of a loss.


Previous Article
Next Article

Similar Reads

Log based Recovery in DBMS
The atomicity property of DBMS states that either all the operations of transactions must be performed or none. The modifications done by an aborted transaction should not be visible to the database and the modifications done by the committed transaction should be visible. To achieve our goal of atomicity, the user must first output stable storage
7 min read
What is Disaster Recovery Planning in DBMS?
A Disaster Recovery Plan in DBMS is a combination of processes, policies, procedures, and key metrics that gives an organization the ability to recover all vital infrastructures, databases, applications, and services after a disaster. Disaster Recovery plans are generally part of a more extensive practice known as Business Continuity Planning. What
6 min read
Database Recovery Techniques in DBMS
Database Systems like any other computer system, are subject to failures but the data stored in them must be available as and when required. When a database fails it must possess the facilities for fast recovery. It must also have atomicity i.e. either transactions are completed successfully and committed (the effect is recorded permanently in the
10 min read
Algorithm for Recovery and Isolation Exploiting Semantics (ARIES)
Algorithm for Recovery and Isolation Exploiting Semantics (ARIES) is based on the Write Ahead Log (WAL) protocol. Every update operation writes a log record which is one of the following : Undo-only log record: Only the before image is logged. Thus, an undo operation can be done to retrieve the old data. Redo-only log record: Only the after image i
2 min read
Database Recovery Models
Every database require a recovery model which signifies that what sort of backup is required or can be perform by the user to restore the data which could be lost due to any hardware failure or other issue. There are generally three types of recovery models of database, these are explained as following below. 1. Simple Recovery : In this model, the
3 min read
Recovery With Concurrent Transactions
Concurrency control means that multiple transactions can be executed at the same time and then the interleaved logs occur. But there may be changes in transaction results so maintain the order of execution of those transactions. During recovery, it would be very difficult for the recovery system to backtrack all the logs and then start recovering.
3 min read
Difference between Backup and Recovery
1. Backup: Backup refers to storing a copy of original data which can be used in case of data loss. Backup is considered one of the approaches to data protection. Important data of the organization needs to be kept in backup efficiently for protecting valuable data. Backup can be achieved by storing a copy of the original data separately or in a da
3 min read
Recovery from failures in Two Phase Commit Protocol (Distributed Transaction)
Prerequisite: Two-Phase Commit ProtocolIn the 2-phase commit protocol, the sites contributing to a distributed transaction and the coordinator that is managing the whole transaction globally may fail or crash, and this could lead to the whole transaction failure. Since unanimity is required in order to commit a distributed transaction successfully
4 min read
Need for DBMS
A Data Base Management System is a system software for easy, efficient and reliable data processing and management. It can be used for: Creation of a database.Retrieval of information from the database.Updating the database.Managing a database.Multiple User InterfaceData scalability, expandability and flexibility: We can change schema of the databa
4 min read
Introduction of Relational Model and Codd Rules in DBMS
Pre-Requisite: Relational Model in DBMS It was proposed by Dr. E.F. Codd. It uses the concept of relations to represent each and every file. Relations are Two-Dimensional Tables. It is easy to implement and easy to simplification in the operations to manipulate the data. This is the most popular data model. It is simple to implement. It uses the pr
12 min read
three90RightbarBannerImg