SlideShare ist ein Scribd-Unternehmen logo
1 von 16
By C.Aruna Devi(DSCASC) 1
Database Recovery
Techniques
Chapter 11
UNIT V
Data Base Management System
[DBMS]
By C.Aruna Devi(DSCASC) 2
Database Recovery
Purpose of Database Recovery:
• To bring the database into the last consistent state, which
existed prior to the failure.
• To preserve transaction properties (Atomicity, Consistency,
Isolation and Durability).
Example: If the system crashes before a fund transfer transaction
completes its execution, then either one or both accounts may have
incorrect value.
Thus, the database must be restored to the state before the
transaction modified any of the accounts.
By C.Aruna Devi(DSCASC) 3
Database Recovery
Types of Failure:
The database may become unavailable for use due to
• Transaction failure: Transactions may fail because of
incorrect input, deadlock, incorrect synchronization.
• System failure: System may fail because of addressing
error, application error, operating system fault, RAM
failure, etc.
• Media failure: Disk head crash, power disruption, etc.
By C.Aruna Devi(DSCASC) 4
Database Recovery
Data Update:
• Deferred Update: All modified data items in the cache is
written either after a transaction ends its execution or
after a fixed number of transactions have completed their
execution.
• Immediate Update: As soon as a data item is modified
in the cache, the disk copy is updated.
By C.Aruna Devi(DSCASC) 5
Recovery Techniques
Recovery Techniques Based on Deferred Update
(No Undo/Redo).
Recovery Techniques Based on Immediate
Update.
By C.Aruna Devi(DSCASC) 6
Recovery Techniques
Recovery Techniques Based on Deferred Update:
Deferred update techniques is to defer or postpone any
actual updates to the database until the transaction
completes its execution successfully, and reaches its commit
point.
A set of transactions records their updates in the log and
cache buffers.
After the transaction reaches its commit point and the log is
force written to disk, the updates are recorded in the
database.
By C.Aruna Devi(DSCASC) 7
Recovery Techniques Based on Deferred Update
If a transaction fails before reaching its commit point, there is no need
to undo any operations, because the transaction has not affected the
database on disk.
We can state a typical deferred update protocol as follow:
A transaction cannot change the database on disk until it reaches its
commit point.
A transaction does not reach its commit point until all its update
operations are recorded in the log and the log is forced written to disk.
By C.Aruna Devi(DSCASC) 8
Deferred Update in a single-user system
Deferred Update in a single-user system:
There is no concurrent data sharing in a single user system.
The data update goes as follows:
 A set of transactions records their updates in the log.
 After the transaction reaches its commit point and the log is
force written to disk, the updates are recorded in the database.
After reboot from a failure the log is used to redo all the
transactions affected by this failure.
By C.Aruna Devi(DSCASC) 9
Deferred Update in a single-user system
(a) T1 T2
read_item (A) read_item (B)
read_item (D) write_item (B)
write_item (D) read_item (D)
write_item (D)
(b)
[start_transaction, T1]
[write_item, T1, D, 20]
[commit T1]
[start_transaction, T2]
[write_item, T2, B, 10]
[write_item, T2, D, 25] ← system crash
The [write_item, …] operations of T1 are redone.
T2 log entries are ignored by the recovery manager.
By C.Aruna Devi(DSCASC) 10
Deferred Update with concurrent users
Deferred Update with concurrent users:
This environment requires some concurrency control mechanism to
guarantee isolation property of transactions.
In a system recovery transactions which were recorded in the log after
the last checkpoint were redone.
The recovery manager may scan some of the transactions recorded
before the checkpoint.
By C.Aruna Devi(DSCASC) 11
Deferred Update with concurrent users
T1
T3
T4
T5
system crash
Time
T2
t1 t2
checkpoint
Recovery in a concurrent users environment.
Example:
•When the checkpoint was taken at time t1, transaction T1 had committed, where as transactions T3 & T4
had not.
• Before the system crash at time t2, T3 & T2 were committed but not T4 & T5.
• According to RDU_M method, there is no need to redo the write_item operations of transaction T1.
• Write_item operation of T2 & T3 must be redone because both transaction reached their commit point after
the last check point.
• Recall that the log is force-written before committing a transaction.
• Transaction T4 & T5 are ignored.
• They are effectively canceled or rolled back because none of their write_item operations were recorded in
the database.
By C.Aruna Devi(DSCASC) 12
Deferred Update with concurrent users
(a) T1 T2 T3 T4
read_item (A) read_item (B) read_item (A) read_item (B)
read_item (D) write_item (B) write_item (A) write_item (B)
write_item (D) read_item (D) read_item (C) read_item (A)
write_item (D) write_item (C) write_item (A)
(b) [start_transaction, T1]
[write_item, T1, D, 20]
[commit, T1]
[checkpoint]
[start_transaction, T4]
[write_item, T4, B, 15]
[write_item, T4, A, 20]
[commit, T4]
[start_transaction T2]
[write_item, T2, B, 12]
[start_transaction, T3]
[write_item, T3, A, 30]
[write_item, T2, D, 25] ← system crash
T2 and T3 are ignored because they did not reach their commit points.
T4 is redone because its commit point is after the last checkpoint.
By C.Aruna Devi(DSCASC) 13
Two tables are required for implementing this protocol:
Active table: All active transactions are entered in this table.
Commit table: Transactions to be committed are entered in this
table.
During recovery, all transactions of the commit table are redone and
all transactions of active tables are ignored since none of them
reached the database.
It is possible that a commit table transaction may be redone twice
but this does not create any inconsistency because of a redone is
“idempotent.
Deferred Update with concurrent users
By C.Aruna Devi(DSCASC) 14
Recovery Techniques Based on Immediate Update
Recovery Techniques Based on Immediate Update:
 This technique, when a transaction issues an update command, the database can
be updated “immediately” without any need to wait for the transaction to reach
its commit point.
 However an update operation must still be recorded in the log before it applied to
the database.
 Provision must be made for undoing the effect of update operations that have
been applied to the database by a failed transaction.
 This is accomplished by rolling back the transaction and undoing the effect of the
transaction write_item operations.
 If the recovery technique ensures that all updates of a transaction are recorded in
the database on disk before the transaction commits, there is never a need to
REDO any operation of committed transactions.
By C.Aruna Devi(DSCASC) 15
Recovery Techniques Based on Immediate Update
Undo/Redo Algorithm (Single-user environment):
 Recovery schemes of this category apply undo and also redo for
recovery.
 In a single-user environment no concurrency control is required
but a log is maintained.
 Note that at any time there will be one transaction in the system
and it will be either in the commit table or in the active table.
The recovery manager performs:
 Undo of a transaction if it is in the active table.
 Redo of a transaction if it is in the commit table.
By C.Aruna Devi(DSCASC) 16
Recovery Techniques Based on Immediate Update
Undo/Redo Algorithm (Concurrent execution):
 Recovery schemes of this category applies undo and also redo to
recover the database from failure.
 In concurrent execution environment a concurrency control is
required and log is maintained.
 Commit table records transactions to be committed and active
table records active transactions.
 To minimize the work of the recovery manager check pointing is
used.
The recovery performs:
 Undo of a transaction if it is in the active table.
 Redo of a transaction if it is in the commit table.

Weitere ähnliche Inhalte

Was ist angesagt?

Object relational and extended relational databases
Object relational and extended relational databasesObject relational and extended relational databases
Object relational and extended relational databases
Suhad Jihad
 
11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS
koolkampus
 

Was ist angesagt? (20)

Chapter19
Chapter19Chapter19
Chapter19
 
rdbms-notes
rdbms-notesrdbms-notes
rdbms-notes
 
PPL, OQL & oodbms
PPL, OQL & oodbmsPPL, OQL & oodbms
PPL, OQL & oodbms
 
Database backup & recovery
Database backup & recoveryDatabase backup & recovery
Database backup & recovery
 
Recovery techniques
Recovery techniquesRecovery techniques
Recovery techniques
 
Transactions and Concurrency Control
Transactions and Concurrency ControlTransactions and Concurrency Control
Transactions and Concurrency Control
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMS
 
Database recovery
Database recoveryDatabase recovery
Database recovery
 
Backup and recovery in sql server database
Backup and recovery in sql server databaseBackup and recovery in sql server database
Backup and recovery in sql server database
 
Database backup and recovery
Database backup and recoveryDatabase backup and recovery
Database backup and recovery
 
Database System Architectures
Database System ArchitecturesDatabase System Architectures
Database System Architectures
 
2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOL2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOL
 
Distributed DBMS - Unit 5 - Semantic Data Control
Distributed DBMS - Unit 5 - Semantic Data ControlDistributed DBMS - Unit 5 - Semantic Data Control
Distributed DBMS - Unit 5 - Semantic Data Control
 
Object relational and extended relational databases
Object relational and extended relational databasesObject relational and extended relational databases
Object relational and extended relational databases
 
Data mining primitives
Data mining primitivesData mining primitives
Data mining primitives
 
Buffer management
Buffer managementBuffer management
Buffer management
 
Recovery Techniques and Need of Recovery
Recovery Techniques and   Need of RecoveryRecovery Techniques and   Need of Recovery
Recovery Techniques and Need of Recovery
 
11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS
 
Recovery system
Recovery systemRecovery system
Recovery system
 
Recovery system
Recovery systemRecovery system
Recovery system
 

Ähnlich wie Dbms ii mca-ch11-recovery-2013

DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptxDBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
HemaSenthil5
 
Introduction to transaction processing
Introduction to transaction processingIntroduction to transaction processing
Introduction to transaction processing
Jafar Nesargi
 
Chapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processingChapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processing
Jafar Nesargi
 
Chapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processingChapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processing
Jafar Nesargi
 
Databases: Backup and Recovery
Databases: Backup and RecoveryDatabases: Backup and Recovery
Databases: Backup and Recovery
Damian T. Gordon
 

Ähnlich wie Dbms ii mca-ch11-recovery-2013 (20)

ch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.pptch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.ppt
 
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
 
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...
 
Adbms 34 transaction processing and recovery
Adbms 34 transaction processing and recoveryAdbms 34 transaction processing and recovery
Adbms 34 transaction processing and recovery
 
ch-5 advanced db.pdf
ch-5 advanced db.pdfch-5 advanced db.pdf
ch-5 advanced db.pdf
 
Transactionsmanagement
TransactionsmanagementTransactionsmanagement
Transactionsmanagement
 
DBMS UNIT IV.pptx
DBMS UNIT IV.pptxDBMS UNIT IV.pptx
DBMS UNIT IV.pptx
 
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptxDBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
 
2 recovery
2 recovery2 recovery
2 recovery
 
UNIT 4- CRASH AND RECOVERY.pdf
UNIT 4- CRASH AND RECOVERY.pdfUNIT 4- CRASH AND RECOVERY.pdf
UNIT 4- CRASH AND RECOVERY.pdf
 
Data (1)
Data (1)Data (1)
Data (1)
 
Tranasaction management
Tranasaction managementTranasaction management
Tranasaction management
 
Introduction to transaction processing
Introduction to transaction processingIntroduction to transaction processing
Introduction to transaction processing
 
Chapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processingChapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processing
 
Chapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processingChapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processing
 
Databases: Backup and Recovery
Databases: Backup and RecoveryDatabases: Backup and Recovery
Databases: Backup and Recovery
 
Introduction to transaction management
Introduction to transaction managementIntroduction to transaction management
Introduction to transaction management
 
Dbms
DbmsDbms
Dbms
 
Recovery System.pptx
Recovery System.pptxRecovery System.pptx
Recovery System.pptx
 
Assignment#13
Assignment#13Assignment#13
Assignment#13
 

Mehr von Prosanta Ghosh

Mehr von Prosanta Ghosh (10)

Normalization case
Normalization caseNormalization case
Normalization case
 
Dbms ii mca-ch12-security-2013
Dbms ii mca-ch12-security-2013Dbms ii mca-ch12-security-2013
Dbms ii mca-ch12-security-2013
 
Dbms ii mca-ch10-concurrency-control-2013
Dbms ii mca-ch10-concurrency-control-2013Dbms ii mca-ch10-concurrency-control-2013
Dbms ii mca-ch10-concurrency-control-2013
 
Dbms ii mca-ch9-transaction-processing-2013
Dbms ii mca-ch9-transaction-processing-2013Dbms ii mca-ch9-transaction-processing-2013
Dbms ii mca-ch9-transaction-processing-2013
 
Dbms ii mca-ch8-db design-2013
Dbms ii mca-ch8-db design-2013Dbms ii mca-ch8-db design-2013
Dbms ii mca-ch8-db design-2013
 
Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013
 
Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013
 
Dbms ii mca-ch3-er-model-2013
Dbms ii mca-ch3-er-model-2013Dbms ii mca-ch3-er-model-2013
Dbms ii mca-ch3-er-model-2013
 
Dbms ii mca-ch1-ch2-intro-datamodel-2013
Dbms ii mca-ch1-ch2-intro-datamodel-2013Dbms ii mca-ch1-ch2-intro-datamodel-2013
Dbms ii mca-ch1-ch2-intro-datamodel-2013
 

Kürzlich hochgeladen

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Kürzlich hochgeladen (20)

How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 

Dbms ii mca-ch11-recovery-2013

  • 1. By C.Aruna Devi(DSCASC) 1 Database Recovery Techniques Chapter 11 UNIT V Data Base Management System [DBMS]
  • 2. By C.Aruna Devi(DSCASC) 2 Database Recovery Purpose of Database Recovery: • To bring the database into the last consistent state, which existed prior to the failure. • To preserve transaction properties (Atomicity, Consistency, Isolation and Durability). Example: If the system crashes before a fund transfer transaction completes its execution, then either one or both accounts may have incorrect value. Thus, the database must be restored to the state before the transaction modified any of the accounts.
  • 3. By C.Aruna Devi(DSCASC) 3 Database Recovery Types of Failure: The database may become unavailable for use due to • Transaction failure: Transactions may fail because of incorrect input, deadlock, incorrect synchronization. • System failure: System may fail because of addressing error, application error, operating system fault, RAM failure, etc. • Media failure: Disk head crash, power disruption, etc.
  • 4. By C.Aruna Devi(DSCASC) 4 Database Recovery Data Update: • Deferred Update: All modified data items in the cache is written either after a transaction ends its execution or after a fixed number of transactions have completed their execution. • Immediate Update: As soon as a data item is modified in the cache, the disk copy is updated.
  • 5. By C.Aruna Devi(DSCASC) 5 Recovery Techniques Recovery Techniques Based on Deferred Update (No Undo/Redo). Recovery Techniques Based on Immediate Update.
  • 6. By C.Aruna Devi(DSCASC) 6 Recovery Techniques Recovery Techniques Based on Deferred Update: Deferred update techniques is to defer or postpone any actual updates to the database until the transaction completes its execution successfully, and reaches its commit point. A set of transactions records their updates in the log and cache buffers. After the transaction reaches its commit point and the log is force written to disk, the updates are recorded in the database.
  • 7. By C.Aruna Devi(DSCASC) 7 Recovery Techniques Based on Deferred Update If a transaction fails before reaching its commit point, there is no need to undo any operations, because the transaction has not affected the database on disk. We can state a typical deferred update protocol as follow: A transaction cannot change the database on disk until it reaches its commit point. A transaction does not reach its commit point until all its update operations are recorded in the log and the log is forced written to disk.
  • 8. By C.Aruna Devi(DSCASC) 8 Deferred Update in a single-user system Deferred Update in a single-user system: There is no concurrent data sharing in a single user system. The data update goes as follows:  A set of transactions records their updates in the log.  After the transaction reaches its commit point and the log is force written to disk, the updates are recorded in the database. After reboot from a failure the log is used to redo all the transactions affected by this failure.
  • 9. By C.Aruna Devi(DSCASC) 9 Deferred Update in a single-user system (a) T1 T2 read_item (A) read_item (B) read_item (D) write_item (B) write_item (D) read_item (D) write_item (D) (b) [start_transaction, T1] [write_item, T1, D, 20] [commit T1] [start_transaction, T2] [write_item, T2, B, 10] [write_item, T2, D, 25] ← system crash The [write_item, …] operations of T1 are redone. T2 log entries are ignored by the recovery manager.
  • 10. By C.Aruna Devi(DSCASC) 10 Deferred Update with concurrent users Deferred Update with concurrent users: This environment requires some concurrency control mechanism to guarantee isolation property of transactions. In a system recovery transactions which were recorded in the log after the last checkpoint were redone. The recovery manager may scan some of the transactions recorded before the checkpoint.
  • 11. By C.Aruna Devi(DSCASC) 11 Deferred Update with concurrent users T1 T3 T4 T5 system crash Time T2 t1 t2 checkpoint Recovery in a concurrent users environment. Example: •When the checkpoint was taken at time t1, transaction T1 had committed, where as transactions T3 & T4 had not. • Before the system crash at time t2, T3 & T2 were committed but not T4 & T5. • According to RDU_M method, there is no need to redo the write_item operations of transaction T1. • Write_item operation of T2 & T3 must be redone because both transaction reached their commit point after the last check point. • Recall that the log is force-written before committing a transaction. • Transaction T4 & T5 are ignored. • They are effectively canceled or rolled back because none of their write_item operations were recorded in the database.
  • 12. By C.Aruna Devi(DSCASC) 12 Deferred Update with concurrent users (a) T1 T2 T3 T4 read_item (A) read_item (B) read_item (A) read_item (B) read_item (D) write_item (B) write_item (A) write_item (B) write_item (D) read_item (D) read_item (C) read_item (A) write_item (D) write_item (C) write_item (A) (b) [start_transaction, T1] [write_item, T1, D, 20] [commit, T1] [checkpoint] [start_transaction, T4] [write_item, T4, B, 15] [write_item, T4, A, 20] [commit, T4] [start_transaction T2] [write_item, T2, B, 12] [start_transaction, T3] [write_item, T3, A, 30] [write_item, T2, D, 25] ← system crash T2 and T3 are ignored because they did not reach their commit points. T4 is redone because its commit point is after the last checkpoint.
  • 13. By C.Aruna Devi(DSCASC) 13 Two tables are required for implementing this protocol: Active table: All active transactions are entered in this table. Commit table: Transactions to be committed are entered in this table. During recovery, all transactions of the commit table are redone and all transactions of active tables are ignored since none of them reached the database. It is possible that a commit table transaction may be redone twice but this does not create any inconsistency because of a redone is “idempotent. Deferred Update with concurrent users
  • 14. By C.Aruna Devi(DSCASC) 14 Recovery Techniques Based on Immediate Update Recovery Techniques Based on Immediate Update:  This technique, when a transaction issues an update command, the database can be updated “immediately” without any need to wait for the transaction to reach its commit point.  However an update operation must still be recorded in the log before it applied to the database.  Provision must be made for undoing the effect of update operations that have been applied to the database by a failed transaction.  This is accomplished by rolling back the transaction and undoing the effect of the transaction write_item operations.  If the recovery technique ensures that all updates of a transaction are recorded in the database on disk before the transaction commits, there is never a need to REDO any operation of committed transactions.
  • 15. By C.Aruna Devi(DSCASC) 15 Recovery Techniques Based on Immediate Update Undo/Redo Algorithm (Single-user environment):  Recovery schemes of this category apply undo and also redo for recovery.  In a single-user environment no concurrency control is required but a log is maintained.  Note that at any time there will be one transaction in the system and it will be either in the commit table or in the active table. The recovery manager performs:  Undo of a transaction if it is in the active table.  Redo of a transaction if it is in the commit table.
  • 16. By C.Aruna Devi(DSCASC) 16 Recovery Techniques Based on Immediate Update Undo/Redo Algorithm (Concurrent execution):  Recovery schemes of this category applies undo and also redo to recover the database from failure.  In concurrent execution environment a concurrency control is required and log is maintained.  Commit table records transactions to be committed and active table records active transactions.  To minimize the work of the recovery manager check pointing is used. The recovery performs:  Undo of a transaction if it is in the active table.  Redo of a transaction if it is in the commit table.