Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

database recovery techniques


Published on

Published in: Education
  • Login to see the comments

database recovery techniques

  1. 1. DATABASE RECOVERYTECHNIQUESGroup – 06 Computer Science and Technology
  2. 2. Introduction Database recovery is the process of restoring the database to the most recent consistent state that existed just before the failure. Three states of database recovery:  Pre-condition: At any given point in time the database is in a consistent state.  Condition: Occurs some kind of system failure.  Post-condition: Restore the database to the consistent state that existed before the failure
  3. 3. Types of failures 1. Transaction failures.  Erroneous parameter values  Logical programming errors  System errors like integer overflow, division by zero  Local errors like “data not found”  User interruption.  Concurrency control enforcement 2. Malicious transactions. 3. System crash.  A hardware, software, or network error (also called media failure) 4. Disk crash.
  4. 4. Before step into recovery.Commit point:Every transaction has a commit point.This is the point at which it is finished, and all of thedatabase modifications are made a permanent partof the database.
  5. 5. Recovery approaches Steal approach-cache page updated by a transaction can be written to disk before the transaction commits. No-steal approach -cache page updated by a transaction cannot be written to disk before the transaction commits. Force approach- when a transaction commits, all pages updated by the transaction are immediately written to disk. No-force approach-when a transaction commits, all pages updated by the transaction are not immediately written to disk.
  6. 6. Basic Update Strategies Update strategies may be placed into two basic categories. Most practical strategies are a combination of these two: Deferred Update Immediate Update
  7. 7. Cont.1. Deferred Update (No -Undo/Redo Algorithm)  These techniques do not physically update the DB on disk until a transaction reaches its commit point.  These techniques need only to redo the committed transaction and no-undo is needed in case of failure.
  8. 8. Cont.While a transaction runs: Changes made by that transaction are not recorded in the database.On a commit: The new data is recorded in a log file and flushed to disk The new data is then recorded in the database itself. On an abort, do nothing (the database has not been changed). On a system restart after a failure, REDO the log.
  9. 9. Cont.2. Immediate Update (Undo/Redo Algorithm)  The DB may be updated by some operations of a transaction before the transaction reaches it’s commit point.  The updates are recorded in the log must contain the old values and new values.  These techniques need to undo the operations of the uncommitted transactions and redo the operations of the committed transactions .
  10. 10. Cont.While a transaction runs: Changes made by the transaction can be written to the database at any time. Both original and the new data being written, must be stored in the log before storing it on the disk.On a commit: All the updates which has not yet been recorded on the disk is first stored in the log file and then flushed to disk. The new data is then recorded in the database itself. On an abort, redo all the changes which that transaction has made to the database disk using the log entries. On a system restart after a failure, redo committed changes from log.
  11. 11. Shadow Paging In this technique, the database is considered to be made up of fixed-size disk blocks or pages for recovery purposes. Maintains two tables during the lifetime of a transaction-current page table and shadow page table. Store the shadow page table in nonvolatile storage, to recover the state of the database prior to transaction execution This is a technique for providing atomicity and durability.When a transaction begins executing
  12. 12. Cont.To recover from a failureAdvantages •No-redo/no-undoDisadvantages •Creating shadow directory may take a long time. •Updated database pages change locations. •Garbage collection is needed
  13. 13. “ARIES” Recovery algorithm.Recovery algorithms are techniques to ensure databaseconsistency ,transaction atomicity and durability without any failure. Recovery algorithms have two parts 1. Actions taken during normal transaction processing to ensure enough information exists to recover from failures. 2. Actions taken after a failure to recover the database contents to a state that ensures atomicity, consistency and durability.
  14. 14. Cont. ARIES (Algorithms for Recovery and Isolation Exploiting Semantics) The ARIES recovery algorithm consist of three steps• Analysis• Redo• Undo
  15. 15. Cont. Analysis - Identify the dirty pages(updated pages) in the buffer and set of active transactions at the time of failure. Redo - Re-apply updates from the log to the database. It will be done for the committed transactions. Undo - Scan the log backward and undo the actions of the active transactions in the reverse order.
  16. 16. Recovery from disk crashes. Recovery from disk crashes is much more difficult than recovery from transaction failures or machines crashes. Loss from such crashes is much less common today than it was previously, because of the wide use of redundancy in secondary storage (RAID technology). (RAID - method of combining several hard disk drives into one logical unit.)Typical methods are; The log for the database system is usually written on a separate physical disk from the database. or, Periodically, the database is also backed up to tape or other archival storage.
  17. 17. Conclusion. Types of failures. Steal/no steal, Force/no force approaches. Deferred and immediate update strategies. Shadow paging technique. ARIES recovery algorithm. Recovery from disk crashes.
  18. 18. Thank you !