Database  Recovery Techniques Chapter 19
Recovery Concepts Recovery Techniques based on Deferred Update Recovery Techniques Based on Immediate Update Shadow Paging The Aries Recovery Algorithm Recovery in Multidatabase Systems Chapter Outline
Recovery from transaction failures means that the database is restored to the most recent consistent state just before the time of failure. System must keep information that enables recovery from failures. A typical strategy for recovery includes: If database is physically damaged (e.g., disk crash), then recovery method restores a past copy of the database. Recovery from non-catastrophic (transaction) failures may imply a  redo/undo  of some operations (this can be done by information kept in the  system log ). Recovery Concepts
Writing and reading to secondary storage is a performance bottleneck. To increase performance, the DBMS maintains a collection of in-memory buffers, called the DBMS  cache . A directory is used to keep track of which database items are in the buffers (cache). When the DBMS requests action on some item, it first checks the cache directory. If it is not in the cache, then the appropriate disk pages must be copied into the cache. A  dirty bit  (associated with each buffer), indicates whether or not the buffer has been modified. A negative aspect of caching is that is makes recovery from failure more complex. Caching (Buffering) of Disk Blocks
It may be necessary to replace (or flush) some of the cache buffers to make space available for the new item. Two main strategies for flushing a modified buffer: In-place updating:  writes the buffer back to the same original disk location (overwriting old values). Shadowing:  writes an updated buffer at a different disk location. Multiple versions of the data can be maintained. Caching (Buffering) of Disk Blocks
The old value of a data item before updating is called the  before image (BFIM) , and the new value after updating is called the  after image (AFIM). The  shadowing strategy  can keep both the BFIM and the AFIM for recovery. In-place updating  requires use of a  log  for recovery. The BFIM of an updated item must be recorded in the log before BFIM is overwritten with the AFIM (this is known as  write-ahead logging ). Two types of log entry information include: Information needed for UNDO;   contains   the old value   (BFIM) of the item, Information needed for REDO; contains the new value (AFIM) of the item. Caching (Buffering) of Disk Blocks
If a buffer needs to be reused, but it has data written by a transaction that has not committed: A  steal approach  writes the data anyway so the buffer can be reused  ― i.e. the buffer is stolen A  no-steal approach  does not allow the data to be written until the transaction commits When a transaction commits: In a  force approach , all buffers updated by a transaction are immediately written to disk In a  no-force approach , they could be written later Caching (Buffering) of Disk Blocks
Checkpoint  is also a type of entry in the log. It is written into the log when the system writes out to the database on disk all DBMS buffers that have been modified. All transactions that have their [COMMIT, T] entries in the log before a checkpoint entry, do not need to have their WRITE operations REDONE in case of a system crash. The recovery manager of a DBMS must decide at what intervals to take a checkpoint. Checkpoints in the system log
Taking a checkpoint consists of the following actions: Suspend execution of transactions temporarily, Force-write all main memory buffers that have been modified to disk, Write a [CHECKPOINT] record to the log, and force-write the log to disk. Resume execution of transactions. Checkpoints in the system log
If a transaction fails for whatever reason after updating the database, it may be necessary to  roll back  the transaction. Also a transition may need to be roll back because of  cascading rollback  phenomenon.  In practice, cascading rollback of  transactions is never required because practical recovery methods guarantee cascadeless or strict schedules.  Transaction Rollback
FIGURE 19.1 Illustrating cascading  rollback (a process  that never occurs in  strict or cascadeless schedules).  The read and  write operations of  three transactions.  (b) System log at  point of crash. Transaction Rollback
FIGURE 19.1 (continued)  Illustrating cascading rollback  (a process that never occurs in strict or cascadeless schedules). (c) Operations before the crash. Transaction Rollback
Some approaches for recovery from non-catastrophic (transaction) failures can be classified as either: Deferred update:  (NO-UNDO, REDO) The database is not physically updated until after a transaction reaches its commit point. UNDO is not needed REDO may be necessary Immediate update:   (UNDO, NO-REDO) The database is physically updated before the transaction reaches to its commit point. UNDO may be necessary when a transaction fails REDO is not needed. Recovery Techniques
A  deferred update  method can be classified as a no-steal approach. It obey the following rules: A transaction cannot change the database on disk until it reaches its commit point, A transaction does not reach its commit point until all its update operations are recorded in the log and the log is force-written to disk. Because the database is never updated on disk until after the transaction commits, there is never the need to UNDO any operations (that is why a deferred update is known as  NO-UNDO/REDO recovery algorithm ). Recovery Techniques Based on Deferred Update
Recovery using  deferred update  in a single user environment uses the following procedure: PROCEDURE RDU:   apply the REDO operation to all the WRITE_ITEM operations of the committed transactions from the log in the order in which they were written to the log. Restart the active transactions. The REDO operation must be  idempotent  – that is, executing it over and over is equivalent to executing it just once. Recovery Techniques Based on Deferred Update
FIGURE 19.2  An example of recovery using deferred update in a single-user environment.  The READ and WRITE operations of two transactions.  The system log at the point of crash. Recovery Techniques Based on Deferred Update
FIGURE 19.3 An example of recovery in a multiuser environment. Recovery Techniques Based on Deferred Update
FIGURE 19.4  An example of  recovery using  deferred update with concurrent  transactions.  (a) The READ  and WRITE  operations  of four  transactions.  (b) System log  at the point  of crash. Recovery Techniques Based on Deferred Update
In  immediate update  techniques, although the database can be updated immediately, update operations must be recorded in the log (on disk) before being applied to the database. There is never a need to REDO any operations of committed transactions (this is called the  UNDO/NO-REDO recovery algorithm ). The effect of all active transactions at the time of failure must be undone. Recovery Techniques Based on Immediate Update
Recovery using immediate update uses the following recovery procedure: PROCEDURE RIU:   UNDO all the WRITE_ITEM operations of the active (uncommitted) transactions from the log. The operations should be done in the reverse of the order in which they were written into the log. Restart the active transactions. Recovery Techniques Based on Immediate Update
Shadow Paging  is a NO-UNDO, NO-REDO approach to recovery. In a single-user environment, does not require the use of a log. In a multiuser environment, a log may be needed for the concurrency control method. It considers the database to be made up of a number of fixed-size disk pages (located in the main memory). When a transactions begins it creates its own  current  and  shadow directories When a WRITE_ITEM operation is performed, a new copy of the modified DB page is created and the current directory is modified Recovery from a failure requires freeing the modified pages and discarding the current directory. Shadow Paging
FIGURE 19.5 An example of shadow paging. Shadow Paging
ARIES  is a REDO/UNDO approach to recovery,  steal/no-force  approach for writing Recovery procedure has three main phases: Analysis phase:  identifies the dirty (updated) pages in the buffer, and the set of active transactions. Finds where in the log to begin REDO. REDO phase:  reapplies updates from the log in order to bring the database to the state it was in before failure. UNDO phase:  the log is scanned backwards and the operations of transactions that were active at the time of the crash are undone in reverse order. The ARIES Recovery Algorithm
FIGURE 19.6 An example of  recovery in  ARIES.  (a) The log at  point of crash.  (b) Transaction  and Dirty Page  Tables at time  of checkpoint.  (c) The  Transaction  and Dirty Page  Tables after the  analysis phase. The ARIES Recovery Algorithm
A  multidatabase transaction  is a transaction that requires access to multiple databases. A  global recovery manager  (or  coordinator ) performs the  two-phase commit protocol : When all   participating databases signal the coordinator that   the part of the multidatabase transaction involving each has concluded, the coordinator sends a message “prepare for commit” to each participant, If all participating databases reply “OK”, the transaction is successful and the coordinator sends a “commit” signal to the participating databases; otherwise it sends a message “roll back” or UNDO the local effect of the transaction to each participating database. Recovery in Multidatabase Systems
A key assumption in our discussion of non-catastrophic failures has been that the system log is maintained on the disk and is not lost as a result of the failure. The recovery manager of a DBMS must also be equipped to handle catastrophic failures. The main technique used to handle catastrophic failures (such as disk crashes) is that of database backup. Hence, the whole database and the log are periodically copied onto a cheap storage medium such as magnetic tapes (in case of a catastrophic failure, the latest backup copy can be reloaded). Recovery from Catastrophic Failures

More Related Content

PDF
Database recovery techniques
PPTX
database recovery techniques
PPTX
Page replacement algorithms
PPT
Dbms ii mca-ch11-recovery-2013
PPTX
Concurrency Control in Database Management System
PPTX
Distributed database management system
DOCX
Joins in dbms and types
PPTX
Data Designs (Software Engg.)
Database recovery techniques
database recovery techniques
Page replacement algorithms
Dbms ii mca-ch11-recovery-2013
Concurrency Control in Database Management System
Distributed database management system
Joins in dbms and types
Data Designs (Software Engg.)

What's hot (20)

PPT
15. Transactions in DBMS
PPTX
Overview of Concurrency Control & Recovery in Distributed Databases
PPTX
deadlock handling
PPTX
Dbms acid
PDF
Relational algebra in dbms
PPTX
Transaction management DBMS
PPTX
Entity Relationship Diagrams
PPT
17. Recovery System in DBMS
PPTX
Database , 12 Reliability
PPTX
Relational model
PPTX
Odbms concepts
PDF
Serializability
PPTX
Database failure and recovery 1
PPT
Normalization of database tables
PPTX
Chapter-1 Introduction to Database Management Systems
PPT
Concurrent transactions
PPTX
Temporal databases
PDF
Data Models
PPTX
joins in database
PPT
Database administration and security
15. Transactions in DBMS
Overview of Concurrency Control & Recovery in Distributed Databases
deadlock handling
Dbms acid
Relational algebra in dbms
Transaction management DBMS
Entity Relationship Diagrams
17. Recovery System in DBMS
Database , 12 Reliability
Relational model
Odbms concepts
Serializability
Database failure and recovery 1
Normalization of database tables
Chapter-1 Introduction to Database Management Systems
Concurrent transactions
Temporal databases
Data Models
joins in database
Database administration and security
Ad

Viewers also liked (20)

PPT
Chapter18
PPT
Chapter25
PPTX
Advanced DBMS presentation
PPT
Transaction slide
PPT
16. Concurrency Control in DBMS
PPT
Chapter16
PPT
Chapter23
PPT
En Ch03 Figs
PPT
Chapter17
PDF
Introduction to Bizur
PDF
Aries en el amor por carlos andres campuzano l
PDF
Top 17 Data Recovery System
PPT
Wk6a
PPTX
Timestamp protocols
PPT
Distributed system
PPTX
PPT
Chapter24
PDF
Colorectal Cancer-A Rising Concern
PDF
Payilagam oracle sql & plsql training syllabus
PPT
Oracle Baisc Tutorial
Chapter18
Chapter25
Advanced DBMS presentation
Transaction slide
16. Concurrency Control in DBMS
Chapter16
Chapter23
En Ch03 Figs
Chapter17
Introduction to Bizur
Aries en el amor por carlos andres campuzano l
Top 17 Data Recovery System
Wk6a
Timestamp protocols
Distributed system
Chapter24
Colorectal Cancer-A Rising Concern
Payilagam oracle sql & plsql training syllabus
Oracle Baisc Tutorial
Ad

Similar to Chapter19 (20)

DOC
What is Database Backup? The 3 Important Recovery Techniques from transaction...
PPTX
Chapter22 database security in dbms.pptx
PPTX
chapter22 Database Management Lecture Slides .pptx
PPT
Recovery (2)
PPT
ch 5 Daatabase Recovery.ppt
PPTX
Lec 4 Recovery in database management system.pptx
PPT
Recovery
PDF
ch-5 advanced db.pdf
PPTX
Metropolis GIS System for Rishikesh City
PPT
Unit-V Recovery software wngineering should learn software
PPTX
Recovery System.pptx
PDF
Recovery
PPTX
LECTURE 11-Backup and Recovery - Dr Preeti Aggarwal.pptx
PDF
DBMS data recovery techniques and slides pptx
PDF
Database recovery techniques and slides pptx
PDF
DOCX
DBMS lecture notes on 4 useful for stidents
PPTX
Recovery system
PPTX
Recovery techniques
PPTX
recovery system
What is Database Backup? The 3 Important Recovery Techniques from transaction...
Chapter22 database security in dbms.pptx
chapter22 Database Management Lecture Slides .pptx
Recovery (2)
ch 5 Daatabase Recovery.ppt
Lec 4 Recovery in database management system.pptx
Recovery
ch-5 advanced db.pdf
Metropolis GIS System for Rishikesh City
Unit-V Recovery software wngineering should learn software
Recovery System.pptx
Recovery
LECTURE 11-Backup and Recovery - Dr Preeti Aggarwal.pptx
DBMS data recovery techniques and slides pptx
Database recovery techniques and slides pptx
DBMS lecture notes on 4 useful for stidents
Recovery system
Recovery techniques
recovery system

Recently uploaded (20)

PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PDF
sustainability-14-14877-v2.pddhzftheheeeee
DOCX
search engine optimization ppt fir known well about this
PDF
The influence of sentiment analysis in enhancing early warning system model f...
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PPT
What is a Computer? Input Devices /output devices
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
Architecture types and enterprise applications.pdf
PDF
Abstractive summarization using multilingual text-to-text transfer transforme...
PPTX
The various Industrial Revolutions .pptx
PDF
Getting started with AI Agents and Multi-Agent Systems
PPTX
2018-HIPAA-Renewal-Training for executives
PDF
OpenACC and Open Hackathons Monthly Highlights July 2025
Credit Without Borders: AI and Financial Inclusion in Bangladesh
sustainability-14-14877-v2.pddhzftheheeeee
search engine optimization ppt fir known well about this
The influence of sentiment analysis in enhancing early warning system model f...
NewMind AI Weekly Chronicles – August ’25 Week III
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
What is a Computer? Input Devices /output devices
Final SEM Unit 1 for mit wpu at pune .pptx
A contest of sentiment analysis: k-nearest neighbor versus neural network
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Benefits of Physical activity for teenagers.pptx
Zenith AI: Advanced Artificial Intelligence
Taming the Chaos: How to Turn Unstructured Data into Decisions
Architecture types and enterprise applications.pdf
Abstractive summarization using multilingual text-to-text transfer transforme...
The various Industrial Revolutions .pptx
Getting started with AI Agents and Multi-Agent Systems
2018-HIPAA-Renewal-Training for executives
OpenACC and Open Hackathons Monthly Highlights July 2025

Chapter19

  • 1.  
  • 2. Database Recovery Techniques Chapter 19
  • 3. Recovery Concepts Recovery Techniques based on Deferred Update Recovery Techniques Based on Immediate Update Shadow Paging The Aries Recovery Algorithm Recovery in Multidatabase Systems Chapter Outline
  • 4. Recovery from transaction failures means that the database is restored to the most recent consistent state just before the time of failure. System must keep information that enables recovery from failures. A typical strategy for recovery includes: If database is physically damaged (e.g., disk crash), then recovery method restores a past copy of the database. Recovery from non-catastrophic (transaction) failures may imply a redo/undo of some operations (this can be done by information kept in the system log ). Recovery Concepts
  • 5. Writing and reading to secondary storage is a performance bottleneck. To increase performance, the DBMS maintains a collection of in-memory buffers, called the DBMS cache . A directory is used to keep track of which database items are in the buffers (cache). When the DBMS requests action on some item, it first checks the cache directory. If it is not in the cache, then the appropriate disk pages must be copied into the cache. A dirty bit (associated with each buffer), indicates whether or not the buffer has been modified. A negative aspect of caching is that is makes recovery from failure more complex. Caching (Buffering) of Disk Blocks
  • 6. It may be necessary to replace (or flush) some of the cache buffers to make space available for the new item. Two main strategies for flushing a modified buffer: In-place updating: writes the buffer back to the same original disk location (overwriting old values). Shadowing: writes an updated buffer at a different disk location. Multiple versions of the data can be maintained. Caching (Buffering) of Disk Blocks
  • 7. The old value of a data item before updating is called the before image (BFIM) , and the new value after updating is called the after image (AFIM). The shadowing strategy can keep both the BFIM and the AFIM for recovery. In-place updating requires use of a log for recovery. The BFIM of an updated item must be recorded in the log before BFIM is overwritten with the AFIM (this is known as write-ahead logging ). Two types of log entry information include: Information needed for UNDO; contains the old value (BFIM) of the item, Information needed for REDO; contains the new value (AFIM) of the item. Caching (Buffering) of Disk Blocks
  • 8. If a buffer needs to be reused, but it has data written by a transaction that has not committed: A steal approach writes the data anyway so the buffer can be reused ― i.e. the buffer is stolen A no-steal approach does not allow the data to be written until the transaction commits When a transaction commits: In a force approach , all buffers updated by a transaction are immediately written to disk In a no-force approach , they could be written later Caching (Buffering) of Disk Blocks
  • 9. Checkpoint is also a type of entry in the log. It is written into the log when the system writes out to the database on disk all DBMS buffers that have been modified. All transactions that have their [COMMIT, T] entries in the log before a checkpoint entry, do not need to have their WRITE operations REDONE in case of a system crash. The recovery manager of a DBMS must decide at what intervals to take a checkpoint. Checkpoints in the system log
  • 10. Taking a checkpoint consists of the following actions: Suspend execution of transactions temporarily, Force-write all main memory buffers that have been modified to disk, Write a [CHECKPOINT] record to the log, and force-write the log to disk. Resume execution of transactions. Checkpoints in the system log
  • 11. If a transaction fails for whatever reason after updating the database, it may be necessary to roll back the transaction. Also a transition may need to be roll back because of cascading rollback phenomenon. In practice, cascading rollback of transactions is never required because practical recovery methods guarantee cascadeless or strict schedules. Transaction Rollback
  • 12. FIGURE 19.1 Illustrating cascading rollback (a process that never occurs in strict or cascadeless schedules). The read and write operations of three transactions. (b) System log at point of crash. Transaction Rollback
  • 13. FIGURE 19.1 (continued) Illustrating cascading rollback (a process that never occurs in strict or cascadeless schedules). (c) Operations before the crash. Transaction Rollback
  • 14. Some approaches for recovery from non-catastrophic (transaction) failures can be classified as either: Deferred update: (NO-UNDO, REDO) The database is not physically updated until after a transaction reaches its commit point. UNDO is not needed REDO may be necessary Immediate update: (UNDO, NO-REDO) The database is physically updated before the transaction reaches to its commit point. UNDO may be necessary when a transaction fails REDO is not needed. Recovery Techniques
  • 15. A deferred update method can be classified as a no-steal approach. It obey the following rules: A transaction cannot change the database on disk until it reaches its commit point, A transaction does not reach its commit point until all its update operations are recorded in the log and the log is force-written to disk. Because the database is never updated on disk until after the transaction commits, there is never the need to UNDO any operations (that is why a deferred update is known as NO-UNDO/REDO recovery algorithm ). Recovery Techniques Based on Deferred Update
  • 16. Recovery using deferred update in a single user environment uses the following procedure: PROCEDURE RDU: apply the REDO operation to all the WRITE_ITEM operations of the committed transactions from the log in the order in which they were written to the log. Restart the active transactions. The REDO operation must be idempotent – that is, executing it over and over is equivalent to executing it just once. Recovery Techniques Based on Deferred Update
  • 17. FIGURE 19.2 An example of recovery using deferred update in a single-user environment. The READ and WRITE operations of two transactions. The system log at the point of crash. Recovery Techniques Based on Deferred Update
  • 18. FIGURE 19.3 An example of recovery in a multiuser environment. Recovery Techniques Based on Deferred Update
  • 19. FIGURE 19.4 An example of recovery using deferred update with concurrent transactions. (a) The READ and WRITE operations of four transactions. (b) System log at the point of crash. Recovery Techniques Based on Deferred Update
  • 20. In immediate update techniques, although the database can be updated immediately, update operations must be recorded in the log (on disk) before being applied to the database. There is never a need to REDO any operations of committed transactions (this is called the UNDO/NO-REDO recovery algorithm ). The effect of all active transactions at the time of failure must be undone. Recovery Techniques Based on Immediate Update
  • 21. Recovery using immediate update uses the following recovery procedure: PROCEDURE RIU: UNDO all the WRITE_ITEM operations of the active (uncommitted) transactions from the log. The operations should be done in the reverse of the order in which they were written into the log. Restart the active transactions. Recovery Techniques Based on Immediate Update
  • 22. Shadow Paging is a NO-UNDO, NO-REDO approach to recovery. In a single-user environment, does not require the use of a log. In a multiuser environment, a log may be needed for the concurrency control method. It considers the database to be made up of a number of fixed-size disk pages (located in the main memory). When a transactions begins it creates its own current and shadow directories When a WRITE_ITEM operation is performed, a new copy of the modified DB page is created and the current directory is modified Recovery from a failure requires freeing the modified pages and discarding the current directory. Shadow Paging
  • 23. FIGURE 19.5 An example of shadow paging. Shadow Paging
  • 24. ARIES is a REDO/UNDO approach to recovery, steal/no-force approach for writing Recovery procedure has three main phases: Analysis phase: identifies the dirty (updated) pages in the buffer, and the set of active transactions. Finds where in the log to begin REDO. REDO phase: reapplies updates from the log in order to bring the database to the state it was in before failure. UNDO phase: the log is scanned backwards and the operations of transactions that were active at the time of the crash are undone in reverse order. The ARIES Recovery Algorithm
  • 25. FIGURE 19.6 An example of recovery in ARIES. (a) The log at point of crash. (b) Transaction and Dirty Page Tables at time of checkpoint. (c) The Transaction and Dirty Page Tables after the analysis phase. The ARIES Recovery Algorithm
  • 26. A multidatabase transaction is a transaction that requires access to multiple databases. A global recovery manager (or coordinator ) performs the two-phase commit protocol : When all participating databases signal the coordinator that the part of the multidatabase transaction involving each has concluded, the coordinator sends a message “prepare for commit” to each participant, If all participating databases reply “OK”, the transaction is successful and the coordinator sends a “commit” signal to the participating databases; otherwise it sends a message “roll back” or UNDO the local effect of the transaction to each participating database. Recovery in Multidatabase Systems
  • 27. A key assumption in our discussion of non-catastrophic failures has been that the system log is maintained on the disk and is not lost as a result of the failure. The recovery manager of a DBMS must also be equipped to handle catastrophic failures. The main technique used to handle catastrophic failures (such as disk crashes) is that of database backup. Hence, the whole database and the log are periodically copied onto a cheap storage medium such as magnetic tapes (in case of a catastrophic failure, the latest backup copy can be reloaded). Recovery from Catastrophic Failures