SlideShare a Scribd company logo
1 of 21
Download to read offline
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

More Related Content

Similar to 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 to 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
 

Recently uploaded

Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1GloryAnnCastre1
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 

Recently uploaded (20)

Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 

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