SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
Recovery
Recovery System
n   Failure classification
n   Log based recovery
n   Redo recovery
n   Rollback recovery
n   Immediate update scheme
n   Deferred update scheme
n   Checkpoints
n   Shadow paging
n   Backups                   2
Failure Classification



n   occurs 10-100 times in a minute
n   recovery required in transaction
    execution time


                                       3
Failure Classification



n   occurs several times a week
n   recovery required in a few
    minutes


                                  4
Failure Classification




 n   occurs intermittently
 n   recovery time depends on the nature
     of failure

                                       5
Failure Classification




n   occurs once or twice a year
n   recovery required in a few hours



                                       6
ACID Properties

             Atomicity     is atomic; its effect on the database
                           is either TOTAL or NONE.
                         takes the database from a consistent
        Consistency      state to another consistent state.

                  The intermediate updates should not be
    Isolation     visible to other concurrent transactions
                  until it is COMMITTED.

Durability      The changes to the database COMMITTED by it
                should not be lost through any subsequent
                failure.
                                                             7
How do I get the database
    Transaction                      to its final consistent
    States                          state?

                                  partially       committed
                                 committed
Start
Read Ram’s account      active
Debit Rs. 5000
Update Ram’s account
Read Sita’s account
                                       failed      aborted
Credit Rs. 5000
Update Sita’s account               How do I get the database
End                                 back to its consistent
                                    state?
                                                        8
The Problem: Buffering!
                          in      on
R: 15000   S: 45000     memory   disk
Start
Read Ram’s account      15000    15000

Debit Rs. 5000          10000    15000
Update Ram’s account    10000    15000?
Read Sita’s account     45000    45000
Credit Rs. 5000         50000    45000
Update Sita’s account   50000    45000?
End
R: 10000   S: 50000                       9
Log-based Recovery
n   maintain a log of incremental updates
n   update log before updating the database
    record
n   use synchronous write on log; this may be
    expensive - so, most DBMS‘s use special
    techniques to block log records
n   log can easily get voluminous; periodic
    purging or cyclic reuse resorted to
n   each record minimally contains trans id, data
    id, old value, new value, timestamp
                                               10
Redo Recovery


old
consistent
version

             roll-forward
             using
             after-images
                            new
                            consistent
                            version 11
Rollback Recovery
             rollback
             using           current
             before-images   corrupt
                             verion




old
consistent
verion
                                       12
The Immediate Update Scheme

n   undo the last partial transaction using
    the before entries
n   redo all the past committed transactions
    in the forward direction using the after
    entries
n   undo and redo are idempotent; this is
    important to recover from failure during
    the recovery process

                                         13
The Deferred Update Scheme

n   redo all the past committed transactions in
    the forward direction using the after entries
n   potentially heavy I/O at Commit: reads from
    log file and updates on database file
n   undo and redo are idempotent; this is
    important to recover from failure during the
    recovery process



                                               14
Checkpoints



 n   log keeps growing with the age of the session
 n   recovery gets very time-consuming
 n   most of the efforts are really wasteful since
     the updates are already on the disk, but
     cannot be avoided since there is no way of
     knowing where to start

                                               15
Checkpoints

 n   Stop accepting new transactions
 n   Suspend execution of transactions
     temporarily
 n   flush out all log records onto log file
 n   flush out buffer blocks to database
 n   flush out <checkpoint> log entry onto log file
 n   redefine the last checkpoint as the start of
     the recovery process

                                                16
Shadow Paging Scheme

  fixed
  pointer

                       current
                       page map




            shadow
            page map
                             17
Shadow Paging Scheme
n    To commit a transaction :
    1. Flush all modified pages in main memory
     to disk
    2. Output current page table to disk
    3. Make the current page table the new
     shadow page table, as follows:
     n   keep a pointer to the shadow page table at a fixed
         (known) location on disk.
     n   to make the current page table the new shadow
         page table, simply update the pointer to point to
         current page table on disk
                                                       18
n   Once pointer to shadow page table has
    been written, transaction is committed.
n   No recovery is needed after a crash —
    new transactions can start right away,
    using the shadow page table.
n   Pages not pointed to from
    current/shadow page table should be
    freed (garbage collected).

                                         19
On-line Backups
n   set database to offline mode
n   flush out all log records onto log file
n   flush out <start backup> onto log file
n   maintain backup log version
n   flush out buffer blocks to database
n   copy database to backup file
n   set database to online mode and update
    database using backup log
n   flush out <end backup> onto log file

                                              20
Off-line Backup (Dumps)
n   Media Failure
n   Restore from earlier backup by DBA
    n   Backup utilities available
    n   BACKUP DATABASE
         n   Complete vs Differential
n   Replication Server


                                         21

Más contenido relacionado

Similar a 9

Create guaranteed restore point
Create guaranteed restore pointCreate guaranteed restore point
Create guaranteed restore pointViaggio Italia
 
Introduction to Akka Streams
Introduction to Akka StreamsIntroduction to Akka Streams
Introduction to Akka StreamsKnoldus Inc.
 
version controlling in software development
version controlling in software developmentversion controlling in software development
version controlling in software developmentAnushka Perera
 
Transactionsmanagement
TransactionsmanagementTransactionsmanagement
TransactionsmanagementSanjeev Gupta
 
The Pensions Trust - VM Backup Experiences
The Pensions Trust - VM Backup ExperiencesThe Pensions Trust - VM Backup Experiences
The Pensions Trust - VM Backup Experiencesglbsolutions
 
Preparing Your Kafka Streams Application For Production and Beyond
Preparing Your Kafka Streams Application For Production and BeyondPreparing Your Kafka Streams Application For Production and Beyond
Preparing Your Kafka Streams Application For Production and BeyondHostedbyConfluent
 
ch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.pptch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.pptAdemeCheklie
 
How We Made Scylla Maintenance Easier, Safer and Faster
How We Made Scylla Maintenance Easier, Safer and FasterHow We Made Scylla Maintenance Easier, Safer and Faster
How We Made Scylla Maintenance Easier, Safer and FasterScyllaDB
 
Backing Up and Recovery
Backing Up and RecoveryBacking Up and Recovery
Backing Up and RecoveryMaham Huda
 
When Streaming Needs Batch With Konstantin Knauf | Current 2022
When Streaming Needs Batch With Konstantin Knauf | Current 2022When Streaming Needs Batch With Konstantin Knauf | Current 2022
When Streaming Needs Batch With Konstantin Knauf | Current 2022HostedbyConfluent
 
Disaster recovery in sql server
Disaster recovery in  sql serverDisaster recovery in  sql server
Disaster recovery in sql serverRajib Kundu
 
State Management in Apache Flink : Consistent Stateful Distributed Stream Pro...
State Management in Apache Flink : Consistent Stateful Distributed Stream Pro...State Management in Apache Flink : Consistent Stateful Distributed Stream Pro...
State Management in Apache Flink : Consistent Stateful Distributed Stream Pro...Paris Carbone
 
Deployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna MitchellDeployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna Mitchelldpc
 
Web Performance & Latest in React
Web Performance & Latest in ReactWeb Performance & Latest in React
Web Performance & Latest in ReactTalentica Software
 

Similar a 9 (20)

Create guaranteed restore point
Create guaranteed restore pointCreate guaranteed restore point
Create guaranteed restore point
 
Introduction to Akka Streams
Introduction to Akka StreamsIntroduction to Akka Streams
Introduction to Akka Streams
 
version controlling in software development
version controlling in software developmentversion controlling in software development
version controlling in software development
 
Transactionsmanagement
TransactionsmanagementTransactionsmanagement
Transactionsmanagement
 
ch-5 advanced db.pdf
ch-5 advanced db.pdfch-5 advanced db.pdf
ch-5 advanced db.pdf
 
The Pensions Trust - VM Backup Experiences
The Pensions Trust - VM Backup ExperiencesThe Pensions Trust - VM Backup Experiences
The Pensions Trust - VM Backup Experiences
 
Nova states summit
Nova states summitNova states summit
Nova states summit
 
Preparing Your Kafka Streams Application For Production and Beyond
Preparing Your Kafka Streams Application For Production and BeyondPreparing Your Kafka Streams Application For Production and Beyond
Preparing Your Kafka Streams Application For Production and Beyond
 
ch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.pptch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.ppt
 
How We Made Scylla Maintenance Easier, Safer and Faster
How We Made Scylla Maintenance Easier, Safer and FasterHow We Made Scylla Maintenance Easier, Safer and Faster
How We Made Scylla Maintenance Easier, Safer and Faster
 
Backing Up and Recovery
Backing Up and RecoveryBacking Up and Recovery
Backing Up and Recovery
 
When Streaming Needs Batch With Konstantin Knauf | Current 2022
When Streaming Needs Batch With Konstantin Knauf | Current 2022When Streaming Needs Batch With Konstantin Knauf | Current 2022
When Streaming Needs Batch With Konstantin Knauf | Current 2022
 
Disaster recovery in sql server
Disaster recovery in  sql serverDisaster recovery in  sql server
Disaster recovery in sql server
 
3 transaction
3 transaction3 transaction
3 transaction
 
Chapter19
Chapter19Chapter19
Chapter19
 
State Management in Apache Flink : Consistent Stateful Distributed Stream Pro...
State Management in Apache Flink : Consistent Stateful Distributed Stream Pro...State Management in Apache Flink : Consistent Stateful Distributed Stream Pro...
State Management in Apache Flink : Consistent Stateful Distributed Stream Pro...
 
Deployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna MitchellDeployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna Mitchell
 
4 db recovery
4 db recovery4 db recovery
4 db recovery
 
Web Performance & Latest in React
Web Performance & Latest in ReactWeb Performance & Latest in React
Web Performance & Latest in React
 
2 recovery
2 recovery2 recovery
2 recovery
 

Último

BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
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
 
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
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
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
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
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
 
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
 
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
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
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
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 

Último (20)

BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
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
 
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
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
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
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
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...
 
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
 
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
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
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
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 

9

  • 2. Recovery System n Failure classification n Log based recovery n Redo recovery n Rollback recovery n Immediate update scheme n Deferred update scheme n Checkpoints n Shadow paging n Backups 2
  • 3. Failure Classification n occurs 10-100 times in a minute n recovery required in transaction execution time 3
  • 4. Failure Classification n occurs several times a week n recovery required in a few minutes 4
  • 5. Failure Classification n occurs intermittently n recovery time depends on the nature of failure 5
  • 6. Failure Classification n occurs once or twice a year n recovery required in a few hours 6
  • 7. ACID Properties Atomicity is atomic; its effect on the database is either TOTAL or NONE. takes the database from a consistent Consistency state to another consistent state. The intermediate updates should not be Isolation visible to other concurrent transactions until it is COMMITTED. Durability The changes to the database COMMITTED by it should not be lost through any subsequent failure. 7
  • 8. How do I get the database Transaction to its final consistent States state? partially committed committed Start Read Ram’s account active Debit Rs. 5000 Update Ram’s account Read Sita’s account failed aborted Credit Rs. 5000 Update Sita’s account How do I get the database End back to its consistent state? 8
  • 9. The Problem: Buffering! in on R: 15000 S: 45000 memory disk Start Read Ram’s account 15000 15000 Debit Rs. 5000 10000 15000 Update Ram’s account 10000 15000? Read Sita’s account 45000 45000 Credit Rs. 5000 50000 45000 Update Sita’s account 50000 45000? End R: 10000 S: 50000 9
  • 10. Log-based Recovery n maintain a log of incremental updates n update log before updating the database record n use synchronous write on log; this may be expensive - so, most DBMS‘s use special techniques to block log records n log can easily get voluminous; periodic purging or cyclic reuse resorted to n each record minimally contains trans id, data id, old value, new value, timestamp 10
  • 11. Redo Recovery old consistent version roll-forward using after-images new consistent version 11
  • 12. Rollback Recovery rollback using current before-images corrupt verion old consistent verion 12
  • 13. The Immediate Update Scheme n undo the last partial transaction using the before entries n redo all the past committed transactions in the forward direction using the after entries n undo and redo are idempotent; this is important to recover from failure during the recovery process 13
  • 14. The Deferred Update Scheme n redo all the past committed transactions in the forward direction using the after entries n potentially heavy I/O at Commit: reads from log file and updates on database file n undo and redo are idempotent; this is important to recover from failure during the recovery process 14
  • 15. Checkpoints n log keeps growing with the age of the session n recovery gets very time-consuming n most of the efforts are really wasteful since the updates are already on the disk, but cannot be avoided since there is no way of knowing where to start 15
  • 16. Checkpoints n Stop accepting new transactions n Suspend execution of transactions temporarily n flush out all log records onto log file n flush out buffer blocks to database n flush out <checkpoint> log entry onto log file n redefine the last checkpoint as the start of the recovery process 16
  • 17. Shadow Paging Scheme fixed pointer current page map shadow page map 17
  • 18. Shadow Paging Scheme n To commit a transaction : 1. Flush all modified pages in main memory to disk 2. Output current page table to disk 3. Make the current page table the new shadow page table, as follows: n keep a pointer to the shadow page table at a fixed (known) location on disk. n to make the current page table the new shadow page table, simply update the pointer to point to current page table on disk 18
  • 19. n Once pointer to shadow page table has been written, transaction is committed. n No recovery is needed after a crash — new transactions can start right away, using the shadow page table. n Pages not pointed to from current/shadow page table should be freed (garbage collected). 19
  • 20. On-line Backups n set database to offline mode n flush out all log records onto log file n flush out <start backup> onto log file n maintain backup log version n flush out buffer blocks to database n copy database to backup file n set database to online mode and update database using backup log n flush out <end backup> onto log file 20
  • 21. Off-line Backup (Dumps) n Media Failure n Restore from earlier backup by DBA n Backup utilities available n BACKUP DATABASE n Complete vs Differential n Replication Server 21