Data Recovery in DBMS

The entire DBMS is a very complex structure with multiple transactions being performed and carried out in every second. The toughness and strength of a system depend not only to the complex and secured architecture of a system but also in the way how data are managed and maintained in the worst cases. If the underlying architecture fails or crashes, then there must be some techniques and procedures by which the lost data during a transaction gets recovered.

What is Data Recovery?

It is the method of restoring the database to its correct state in the event of a failure at the time of the transaction or after the end of a process. Earlier you have been given the concept of database recovery as a service which should be provided by all the DBMS for ensuring that the database is dependable and remains in a consistent state in the presence of failures. In this context, dependability refers to both the flexibility of the DBMS to various kinds of failure and its ability to recover from those failures. In this chapter, you will gather a brief knowledge of how this service can be provided. To gain a better understanding of the possible problems you may encounter in providing a consistent system, you will first learn about the need for recovery and its types of failure which usually occurs in a database environment.

What is the Need for Recovery of data?

The storage of data usually includes four types of media with an increasing amount of reliability: the main memory, the magnetic disk, the magnetic tape, and the optical disk. There are many different forms of failure that can have an effect on database processing and/or transaction and each of them has to be dealt with differently. Some data failures can affect main memory only, while others involve non-volatile or secondary storage also. Among the sources of failure are:

  • Due to hardware or software errors, the system crashes which ultimately resulting in loss of main memory.
  • Failures of media, such as head crashes or unreadable media that results in the loss of portions of secondary storage.
  • There can be application software errors, such as logical errors which are accessing the database that can cause one or more transactions to abort or fail.
  • Natural physical disasters can also occur such as fires, floods, earthquakes, or power failures.
  • Carelessness or unintentional destruction of data or directories by operators or users.
  • Damage or intentional corruption or hampering of data (using malicious software or files) hardware or software facilities.

Whatever the grounds of the failure are, there are two principal things that you have to consider:

  • Failure of main memory including that database buffers.
  • Failure of the disk copy of that database.

Recovery Facilities

Every DBMS should offer the following facilities to help out with the recovery mechanism:

  • Backup mechanism¬†makes backup copies at a specific interval for the database.
  • Logging facilities keep tracing the current state of transactions and any changes made to the database.
  • Checkpoint facility allows updates to the database for getting the latest patches to be made permanent and keep secure from vulnerability.
  • Recovery manager allows the database system for restoring the database to a reliable and steady state after any failure occurs.