SlideShare a Scribd company logo
1 of 18
DATABASE RECOVERY
TECHNIQUES
Group – 06   Computer Science and Technology
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
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.
Before step into recovery.


Commit point:
Every transaction has a commit point.
This is the point at which it is finished, and all of the
database modifications are made a permanent part
of the database.
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.
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
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.
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.
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 .
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.
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
Cont.
To recover from a failure




Advantages
    •No-redo/no-undo

Disadvantages
    •Creating shadow directory may take a long time.
    •Updated database pages change locations.
    •Garbage collection is needed
“ARIES” Recovery algorithm.
Recovery algorithms are techniques to ensure database
consistency ,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.
Cont.

   ARIES (Algorithms for Recovery and Isolation
    Exploiting Semantics)

   The ARIES recovery algorithm consist of three steps
•   Analysis
•   Redo
•   Undo
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.
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.
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.
Thank you !

More Related Content

What's hot

Recovery Techniques and Need of Recovery
Recovery Techniques and   Need of RecoveryRecovery Techniques and   Need of Recovery
Recovery Techniques and Need of RecoveryPooja Dixit
 
File organization 1
File organization 1File organization 1
File organization 1Rupali Rana
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMSkoolkampus
 
Database backup and recovery basics
Database backup and recovery basicsDatabase backup and recovery basics
Database backup and recovery basicsShahed Mohamed
 
15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMSkoolkampus
 
NOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLNOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLRamakant Soni
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraintsmadhav bansal
 
Heuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.pptHeuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.pptkarthikaparthasarath
 
Database recovery
Database recoveryDatabase recovery
Database recoveryStudent
 
Distributed database management system
Distributed database management  systemDistributed database management  system
Distributed database management systemPooja Dixit
 
Query optimization
Query optimizationQuery optimization
Query optimizationPooja Dixit
 
Lock based protocols
Lock based protocolsLock based protocols
Lock based protocolsChethanMp7
 

What's hot (20)

Distributed database
Distributed databaseDistributed database
Distributed database
 
Recovery Techniques and Need of Recovery
Recovery Techniques and   Need of RecoveryRecovery Techniques and   Need of Recovery
Recovery Techniques and Need of Recovery
 
File organization 1
File organization 1File organization 1
File organization 1
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMS
 
Database backup and recovery basics
Database backup and recovery basicsDatabase backup and recovery basics
Database backup and recovery basics
 
15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
 
NOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLNOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQL
 
Adbms lab manual
Adbms lab manualAdbms lab manual
Adbms lab manual
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
Heuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.pptHeuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.ppt
 
Database recovery
Database recoveryDatabase recovery
Database recovery
 
Distributed database management system
Distributed database management  systemDistributed database management  system
Distributed database management system
 
Dbms architecture
Dbms architectureDbms architecture
Dbms architecture
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Deadlock dbms
Deadlock dbmsDeadlock dbms
Deadlock dbms
 
Query optimization
Query optimizationQuery optimization
Query optimization
 
Deductive databases
Deductive databasesDeductive databases
Deductive databases
 
Lock based protocols
Lock based protocolsLock based protocols
Lock based protocols
 
Rdbms
RdbmsRdbms
Rdbms
 

Viewers also liked

17. Recovery System in DBMS
17. Recovery System in DBMS17. Recovery System in DBMS
17. Recovery System in DBMSkoolkampus
 
Buffer management --database buffering
Buffer management --database buffering Buffer management --database buffering
Buffer management --database buffering julia121214
 
Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Prosanta Ghosh
 
Transactions in dbms
Transactions in dbmsTransactions in dbms
Transactions in dbmsNancy Gulati
 

Viewers also liked (6)

17. Recovery System in DBMS
17. Recovery System in DBMS17. Recovery System in DBMS
17. Recovery System in DBMS
 
Buffer management --database buffering
Buffer management --database buffering Buffer management --database buffering
Buffer management --database buffering
 
ARIES Recovery Algorithms
ARIES Recovery AlgorithmsARIES Recovery Algorithms
ARIES Recovery Algorithms
 
Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013
 
Unit06 dbms
Unit06 dbmsUnit06 dbms
Unit06 dbms
 
Transactions in dbms
Transactions in dbmsTransactions in dbms
Transactions in dbms
 

Similar to database recovery techniques

What is Database Backup? The 3 Important Recovery Techniques from transaction...
What is Database Backup? The 3 Important Recovery Techniques from transaction...What is Database Backup? The 3 Important Recovery Techniques from transaction...
What is Database Backup? The 3 Important Recovery Techniques from transaction...Raj vardhan
 
UNIT 4- CRASH AND RECOVERY.pdf
UNIT 4- CRASH AND RECOVERY.pdfUNIT 4- CRASH AND RECOVERY.pdf
UNIT 4- CRASH AND RECOVERY.pdfKavitaShinde26
 
Unit no 5 transation processing DMS 22319
Unit no 5 transation processing DMS 22319Unit no 5 transation processing DMS 22319
Unit no 5 transation processing DMS 22319ARVIND SARDAR
 
ch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.pptch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.pptAdemeCheklie
 
Database recovery techniques
Database recovery techniquesDatabase recovery techniques
Database recovery techniquespusp220
 
BACKUP & RECOVERY IN DBMS
BACKUP & RECOVERY IN DBMSBACKUP & RECOVERY IN DBMS
BACKUP & RECOVERY IN DBMSBaivabiNayak
 
Introduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theoryIntroduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theoryZainab Almugbel
 
Transactionsmanagement
TransactionsmanagementTransactionsmanagement
TransactionsmanagementSanjeev Gupta
 
Backing Up and Recovery
Backing Up and RecoveryBacking Up and Recovery
Backing Up and RecoveryMaham Huda
 
Transaction unit 1 topic 4
Transaction unit 1 topic 4Transaction unit 1 topic 4
Transaction unit 1 topic 4avniS
 
Recovery System.pptx
Recovery System.pptxRecovery System.pptx
Recovery System.pptxssuserfb9a21
 
ELNA6eCh21 (1).ppt
ELNA6eCh21 (1).pptELNA6eCh21 (1).ppt
ELNA6eCh21 (1).pptNEILMANOJC1
 

Similar to database recovery techniques (20)

What is Database Backup? The 3 Important Recovery Techniques from transaction...
What is Database Backup? The 3 Important Recovery Techniques from transaction...What is Database Backup? The 3 Important Recovery Techniques from transaction...
What is Database Backup? The 3 Important Recovery Techniques from transaction...
 
UNIT 4- CRASH AND RECOVERY.pdf
UNIT 4- CRASH AND RECOVERY.pdfUNIT 4- CRASH AND RECOVERY.pdf
UNIT 4- CRASH AND RECOVERY.pdf
 
Chapter19
Chapter19Chapter19
Chapter19
 
DBMS Vardhaman.pdf
DBMS Vardhaman.pdfDBMS Vardhaman.pdf
DBMS Vardhaman.pdf
 
ch-5 advanced db.pdf
ch-5 advanced db.pdfch-5 advanced db.pdf
ch-5 advanced db.pdf
 
Unit no 5 transation processing DMS 22319
Unit no 5 transation processing DMS 22319Unit no 5 transation processing DMS 22319
Unit no 5 transation processing DMS 22319
 
ch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.pptch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.ppt
 
2 recovery
2 recovery2 recovery
2 recovery
 
Database recovery techniques
Database recovery techniquesDatabase recovery techniques
Database recovery techniques
 
BACKUP & RECOVERY IN DBMS
BACKUP & RECOVERY IN DBMSBACKUP & RECOVERY IN DBMS
BACKUP & RECOVERY IN DBMS
 
Introduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theoryIntroduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theory
 
Transactionsmanagement
TransactionsmanagementTransactionsmanagement
Transactionsmanagement
 
Dbms
DbmsDbms
Dbms
 
Backing Up and Recovery
Backing Up and RecoveryBacking Up and Recovery
Backing Up and Recovery
 
Transaction unit 1 topic 4
Transaction unit 1 topic 4Transaction unit 1 topic 4
Transaction unit 1 topic 4
 
Recovery System.pptx
Recovery System.pptxRecovery System.pptx
Recovery System.pptx
 
Ch24 system administration
Ch24 system administration Ch24 system administration
Ch24 system administration
 
Ch24
Ch24Ch24
Ch24
 
Crash recovery in database
Crash recovery in databaseCrash recovery in database
Crash recovery in database
 
ELNA6eCh21 (1).ppt
ELNA6eCh21 (1).pptELNA6eCh21 (1).ppt
ELNA6eCh21 (1).ppt
 

More from Kalhan Liyanage

Progressive web app testing
Progressive web app testingProgressive web app testing
Progressive web app testingKalhan Liyanage
 
Cucumber for automated acceptance testing.pptx
Cucumber for automated acceptance testing.pptxCucumber for automated acceptance testing.pptx
Cucumber for automated acceptance testing.pptxKalhan Liyanage
 
How to do a Formal presentaion - features and how to design a formal presentaion
How to do a Formal presentaion - features and how to design a formal presentaionHow to do a Formal presentaion - features and how to design a formal presentaion
How to do a Formal presentaion - features and how to design a formal presentaionKalhan Liyanage
 
The iron lady margaret thatcher
The iron lady margaret thatcherThe iron lady margaret thatcher
The iron lady margaret thatcherKalhan Liyanage
 

More from Kalhan Liyanage (7)

Progressive web app testing
Progressive web app testingProgressive web app testing
Progressive web app testing
 
Cucumber for automated acceptance testing.pptx
Cucumber for automated acceptance testing.pptxCucumber for automated acceptance testing.pptx
Cucumber for automated acceptance testing.pptx
 
Stay Young At Heart
Stay Young At HeartStay Young At Heart
Stay Young At Heart
 
Microsoft corporation
Microsoft corporationMicrosoft corporation
Microsoft corporation
 
How to do a Formal presentaion - features and how to design a formal presentaion
How to do a Formal presentaion - features and how to design a formal presentaionHow to do a Formal presentaion - features and how to design a formal presentaion
How to do a Formal presentaion - features and how to design a formal presentaion
 
The iron lady margaret thatcher
The iron lady margaret thatcherThe iron lady margaret thatcher
The iron lady margaret thatcher
 
Nanotechnology
NanotechnologyNanotechnology
Nanotechnology
 

Recently uploaded

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 

Recently uploaded (20)

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 

database recovery techniques

  • 1. DATABASE RECOVERY TECHNIQUES Group – 06 Computer Science and Technology
  • 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. 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. Before step into recovery. Commit point: Every transaction has a commit point. This is the point at which it is finished, and all of the database modifications are made a permanent part of the database.
  • 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. 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. 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. 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. 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. 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. 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. Cont. To recover from a failure Advantages •No-redo/no-undo Disadvantages •Creating shadow directory may take a long time. •Updated database pages change locations. •Garbage collection is needed
  • 13. “ARIES” Recovery algorithm. Recovery algorithms are techniques to ensure database consistency ,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. Cont.  ARIES (Algorithms for Recovery and Isolation Exploiting Semantics)  The ARIES recovery algorithm consist of three steps • Analysis • Redo • Undo
  • 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. 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. 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.