SlideShare ist ein Scribd-Unternehmen logo
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

Weitere ähnliche Inhalte

Ähnlich wie 9

Create guaranteed restore point
Create guaranteed restore pointCreate guaranteed restore point
Create guaranteed restore point
Viaggio Italia
 
The Pensions Trust - VM Backup Experiences
The Pensions Trust - VM Backup ExperiencesThe Pensions Trust - VM Backup Experiences
The Pensions Trust - VM Backup Experiences
glbsolutions
 
Disaster recovery in sql server
Disaster recovery in  sql serverDisaster recovery in  sql server
Disaster recovery in sql server
Rajib Kundu
 
Deployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna MitchellDeployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna Mitchell
dpc
 

Ähnlich wie 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
 
Excellent VEEAM VMCE_v12 Dumps (V10.02) to Obtain 100% Achievement - DumpsBase
Excellent VEEAM VMCE_v12 Dumps (V10.02) to Obtain 100% Achievement - DumpsBaseExcellent VEEAM VMCE_v12 Dumps (V10.02) to Obtain 100% Achievement - DumpsBase
Excellent VEEAM VMCE_v12 Dumps (V10.02) to Obtain 100% Achievement - DumpsBase
 
Web Performance & Latest in React
Web Performance & Latest in ReactWeb Performance & Latest in React
Web Performance & Latest in React
 

Kürzlich hochgeladen

Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
Avinash Rai
 
IATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdffIATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdff
17thcssbs2
 

Kürzlich hochgeladen (20)

50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
An Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxAn Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptx
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
The Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational ResourcesThe Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational Resources
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdf....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdf
 
The impact of social media on mental health and well-being has been a topic o...
The impact of social media on mental health and well-being has been a topic o...The impact of social media on mental health and well-being has been a topic o...
The impact of social media on mental health and well-being has been a topic o...
 
Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptx
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceutics
 
IATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdffIATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdff
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
 
Advances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdfAdvances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdf
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 

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