Database Recovery Techniques

Database Recovery:

The Database are prone to failures due to inconsistency, network failure, errors or any kind of accidental damage. So, database recovery techniques are highly important to bring a database back into a working state after a failure. There are four different recovery techniques are available in the Database.

1. Mirroring
2. Recovery using Backups
3. Recovery using Transaction Logs
4. Shadow Paging

Mirroring:

Two complete copies of the database maintains on-line on different stable storage devices. This method mostly uses in environments that require non-stop, fault-tolerant operations.

Recovery using Backups:

Backups are useful if there has been extensive damage to database. Backups are mainly two types :

  • Immediate Backup
  • Archival Backup

Immediate Backup:

Immediate Backup are kept in a floppy disk, hard disk or magnetic tapes. These come in handy when a technical fault occurs in the primary database such as a system failure, disk crash, or network failure. Damage due to virus attacks repaired using the immediate backup.

Archival Backup:

Archival Backups are kept in mass storage devices such as magnetic tape, CD-ROMs, Internet Servers etc. They are very useful for recovering data after a disaster such as fire, earthquake, flood etc. Archival Backup should be kept at a different site other than where the system is functioning. Archival Backup at a separate place remains safe from thefts and international destruction by user staff.

Recovery using Transaction Logs:

In Recovery using Transaction Logs, some following steps are :
Step1: The log searches for all the transaction that have recorded a [ start transaction, ‘ ‘] entry, but haven’t recorded a corresponding [commit, ‘ ‘] entry.
Step2: These transactions are rolling back.
Step3: Transactions which have recorded a [commit, ‘ ‘] entry in the log, it must have recorded the changes, they did to the database in the log. These changes will follow to undo their effects on the database.

Database Recovery Techniques

Shadow Paging:

These system can use for data recovery instead of using transaction logs. In Shadow Paging, a database is divided into several fixed-sized disk pages, say n, thereafter a current directory creates. It has n entries with each entry pointing to a disk page in the database. the current directory transfer to the main memory.

When a transaction begins executing, the current directory copies into a shadow directory. Then, the shadow directory saves on the disk. The transaction will be using the current directory. During the transaction execution, all the modifications are made on the current directory and the shadow directory is never modified.