SlideShare a Scribd company logo
What is Database Backup?
• Copying and archiving of computer data so it may be used to restore the original after a
data loss event.
• Purpose is to recover data after it is lost from corruption or deletion.
• Second purpose is to recover data from an earlier time.
What is Database recovery techniques
Recovery techniques are used to ensure database consistency and transaction automaticity and
durability despite failures.
Why recovery is needed? (What causes a Transaction to fail?)
There are several reasons that could cause a transaction to fail in the middle of execution
1. A computer failure (system crash): A hardware or software error occurs in the
computer system during transaction execution. If the hardware crashes, the contents of
the computer’s internal memory may be lost.
2. A transaction or system error : Some operation in the transaction may cause it to fail,
such as integer overflow or division by zero. Transaction failure may also occur because
of a logical programming error. In addition, the user may interrupt the transaction during
its execution.
3. Local errors or exception conditions detected by the transaction.
4. Disk failure: Some disk blocks may lose their data because of a disk read/write head
crash. This may happen during a read or a write operation of the transaction.
5. Physical problems and catastrophes: This refers to an endless list of problems that
includes power or air-conditioning failure, fire, theft, sabotage, overwriting disks or tapes
by mistake, and mounting of a wrong tape by the operator.
There are many different approaches to recover a database:
Manual reprocessing & a variety of automated recovery techniques.
1. Manual Reprocessing
The database is periodically backed up (a database save) and all transactions applied since the
last save are recorded. If the system crashes, the latest database save is restored and all of the
transactions are re-applied (by users) to bring the database back up to the point just before the
crash.
Limitations:
• Time required to reapply transactions
• Transactions might have other (physical) potential failures
• Reapplying concurrent transactions is not straight forward.
2. Automated Recovery
There are several types of automated recovery techniques including: Deferred update,
Immediate update, Shadow paging, etc.
1
A transaction can be in one of the following states:
• Active - when the transaction just begins
• Partially Committed - after the last operation has completed (but before the commit
point is reached)
• Failed - Normal operation is prevented (e.g., in the event of a system crash)
• Aborted - Transaction is rolled back. That is, all of its effects are undone
• Committed - Transaction completes all operations and moved the database to the next
consistent state
The System Log
To be able to recover from failures that affect transactions, the system maintains a log to keep
track of all transactions that affect the values of database items. Each transaction writes the
following information to the log:
• Start(T) - the fact that transaction T has started
• Write(T, X, old_value, new_value) - the fact that transaction T has written to item X
with the new_value. old_value is also maintained.
• Read(T,X)-the fact that transaction T has read data item X either:
Commit(T)-transaction T committed or Abort(T) - transaction T was aborted
Recovery techniques use the following operations:
UNDO (Backward Recovery): Similar to rollback except that it applies to a single operation
rather than to a whole transaction.
REDO (Forward Recovery): This specifies that certain transaction operations must be redone
to ensure that all the operations of a committed transaction have been applied successfully to the
database.
The 3 Important Recovery Techniques from transaction failures:
1. Deferred Update Recovery: Also called NO-UNDO, REDO Technique
This technique defers or postpones any actual updates to the database until the transaction
reaches it commit point.
• During transaction execution, the updates are written to the log file.
• After the transaction reaches it commit point, the log file is force-written to disk, then
the updates are recorded in the database.
• If the 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 in any
way.
• REDO may be necessary.
A typical deferred update protocol uses the following rules:
2
1. A transaction cannot change the database on disk until it reaches its commit point.
2. A transaction does not reach its commit point until all its update operations are
recorded in the log file and the log file is force-written to disk.
3. Because the database is never updated on disk until after the transactions commits,
there is never the need to UNDO any operations. That’s why a recovery techniques based
on deferred update are therefore known as NO UNDO, REDO techniques.
Example:
T1: Ra Rd Wd C
T2: Rb Wb Rd Wd C
T3: Ra Wa Rc Wc C
T4: Rb Wb Ra Wa C
Log file:
Start(T1)
Write(T1, d, old, new)
Commit(T1)
Start(T4)
Write(T4, b, old, new)
Write(T4, a, old, new)
Commit(T4)
Start(T2)
Write(T2, b, old, new)
Start(T3)
Write(T3, a, old, new)
s y s t e m c r a s h
Since T1 and T4 committed, their changes were written to disk. However, T2 and T3 did not
commit, hence their changes were not written to disk. To recover, we simply ignore those
transactions that did not commit.
Advantages:
• Recovery is made easier.
• Any transaction that reached the commit point (from the log) has its writes applied to the
database.
• All other transactions are ignored.
• Cascading rollback does not occur because no other transaction sees the work of another
until it is committed.
Disadvantages:
Concurrency is limited: Must employ Strict 2PL which limits concurrency.
2. Immediate Update Recovery: also called (UNDO, NO-REDO)
• The database is physically updated before the transaction reaches to its commit point.
• UNDO may be necessary when a transaction fails.
3
• REDO is not needed.
A typical deferred update protocol uses the following rules:
1. In immediate update techniques, although the database can be updated immediately,
update operations must be recorded in the log (on disk) before being applied to the
database.
2. There is never a need to REDO any operations of committed transactions (this is
called the UNDO/NO-REDO recovery algorithm).
3. The effect of all active transactions at the time of failure must be undone.
Advantages:
Immediate update allows higher concurrency because transactions write continuously to the
database rather than waiting until the commit point.
Disadvantages:
Step 2 above can lead to cascading rollbacks - time consuming and may be problematic.
3. Shadow paging
• Is a technique for providing automaticity and durability properties related to transaction
control.
• This technique does not require the use of a log in a single-user environment. In a
multiuser environment, a log may be needed for the concurrency control method.
• Shadow paging considers the database to be made up of a number of fixed size disk pages
(or disk blocks)—say, n—for recovery purposes. A directory(page table) with n entries
is constructed, where the ith
entry points to the ith
database page on disk.
• The idea is to maintain 2 directories (page tables) during the lifetime of a transaction,
Current directory & the Shadow directory.
• The directory is kept in main memory if it is not too large, and all references—reads or
writes—to database pages on disk go through it.
• Initially both the directories are identical. Only current directory is used for data item
accesses during execution of the transaction.
• Whenever any page is about to be written for the first time-a copy of this page is made on
to an unused page.
• When a transaction begins executing, the current directory—whose entries point to the
most recent or current database pages on disk—is copied into a shadow directory. The
4
shadow directory is then saved on disk while the current directory is used by the
transaction.
The figure below illustrates the use of Shadow paging techniques:
Advantages:
• The overhead of maintaining the transaction log file is eliminated.
• Since there is no need for undo or redo operations, recovery is significantly fast.
Disadvantages:
• Copying the entire page table is very expensive.
• Complex storage management strategies.
5
shadow directory is then saved on disk while the current directory is used by the
transaction.
The figure below illustrates the use of Shadow paging techniques:
Advantages:
• The overhead of maintaining the transaction log file is eliminated.
• Since there is no need for undo or redo operations, recovery is significantly fast.
Disadvantages:
• Copying the entire page table is very expensive.
• Complex storage management strategies.
5

More Related Content

PDF
Lean Pharma
PDF
DBMS Vardhaman.pdf
PPTX
database recovery techniques
PPTX
BCT 2312 - Chapter 4 - Database Recovery.pptx
PPTX
Lec 4 Recovery in database management system.pptx
PPTX
Recovery techniques
PPTX
Unit Three: Database Recovery Points & Procedures
PPTX
Backing Up and Recovery
Lean Pharma
DBMS Vardhaman.pdf
database recovery techniques
BCT 2312 - Chapter 4 - Database Recovery.pptx
Lec 4 Recovery in database management system.pptx
Recovery techniques
Unit Three: Database Recovery Points & Procedures
Backing Up and Recovery

Similar to What is Database Backup? The 3 Important Recovery Techniques from transaction failures (20)

PPT
Databases: Backup and Recovery
PDF
Advanced database chapter three PowerPoint
PPT
ch 5 Daatabase Recovery.ppt
PPTX
Chapter 3 - Recogfytru6y5tfvery Techniques.pptx
PDF
ch-5 advanced db.pdf
PPTX
gyuftfChapter 1- Recovery Techniques.pptx
PPTX
fffffffChapter 1- Recovery Techniques.pptx
PPTX
Introduction to transaction processing concepts and theory
PDF
UNIT 4- CRASH AND RECOVERY.pdf
PPT
Dbms ii mca-ch11-recovery-2013
PPTX
PPTX
data base management system notes on concurrency control
PPTX
Transactions and concurrency control mechanisms in database management system
PPTX
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
PPTX
Recovery System.pptx
PPTX
Advanced Database System Chapter 2 Transaction.pptx
PPT
Unit-V Recovery software wngineering should learn software
PPTX
PPTX
Data (1)
PDF
Database recovery techniques
Databases: Backup and Recovery
Advanced database chapter three PowerPoint
ch 5 Daatabase Recovery.ppt
Chapter 3 - Recogfytru6y5tfvery Techniques.pptx
ch-5 advanced db.pdf
gyuftfChapter 1- Recovery Techniques.pptx
fffffffChapter 1- Recovery Techniques.pptx
Introduction to transaction processing concepts and theory
UNIT 4- CRASH AND RECOVERY.pdf
Dbms ii mca-ch11-recovery-2013
data base management system notes on concurrency control
Transactions and concurrency control mechanisms in database management system
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
Recovery System.pptx
Advanced Database System Chapter 2 Transaction.pptx
Unit-V Recovery software wngineering should learn software
Data (1)
Database recovery techniques
Ad

More from Raj vardhan (20)

PPTX
Software Testing Life Cycle Unit-3
PPTX
Internet Basics Unit-7
PPTX
Local Area Network – Wired LAN
PPTX
Network Connecting Devices UNIT 5
DOCX
UNIT 4-HEADER FILES IN C
PPTX
Wireless LANs(IEEE802.11) Architecture
PPTX
UNIT -03 Transmission Media and Connecting Devices
PDF
Unit 1: Introduction to DBMS Unit 1 Complete
PPTX
Introduction To Software Concepts Unit 1 & 2
DOCX
Swachh Bharat Abhiyan - Project Report
DOCX
Network Topology
DOCX
Microsoft Office Word Introduction Complete
DOCX
Digital money Revolution Introduction
DOCX
C Programming
PPTX
Definition of Business
PPT
Business Terms & Concepts
PDF
Number System Conversion | BCA
DOCX
Interaction With Computers FIT
DOCX
FIT-MS-WORD Lab | BCA
PDF
Syllabus Front End Design Tool VB.NET | BCA-205
Software Testing Life Cycle Unit-3
Internet Basics Unit-7
Local Area Network – Wired LAN
Network Connecting Devices UNIT 5
UNIT 4-HEADER FILES IN C
Wireless LANs(IEEE802.11) Architecture
UNIT -03 Transmission Media and Connecting Devices
Unit 1: Introduction to DBMS Unit 1 Complete
Introduction To Software Concepts Unit 1 & 2
Swachh Bharat Abhiyan - Project Report
Network Topology
Microsoft Office Word Introduction Complete
Digital money Revolution Introduction
C Programming
Definition of Business
Business Terms & Concepts
Number System Conversion | BCA
Interaction With Computers FIT
FIT-MS-WORD Lab | BCA
Syllabus Front End Design Tool VB.NET | BCA-205
Ad

Recently uploaded (20)

PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
Classroom Observation Tools for Teachers
PDF
01-Introduction-to-Information-Management.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Cell Types and Its function , kingdom of life
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Computing-Curriculum for Schools in Ghana
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Final Presentation General Medicine 03-08-2024.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
FourierSeries-QuestionsWithAnswers(Part-A).pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Complications of Minimal Access Surgery at WLH
Classroom Observation Tools for Teachers
01-Introduction-to-Information-Management.pdf
Anesthesia in Laparoscopic Surgery in India
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPH.pptx obstetrics and gynecology in nursing
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Cell Types and Its function , kingdom of life
TR - Agricultural Crops Production NC III.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Computing-Curriculum for Schools in Ghana

What is Database Backup? The 3 Important Recovery Techniques from transaction failures

  • 1. What is Database Backup? • Copying and archiving of computer data so it may be used to restore the original after a data loss event. • Purpose is to recover data after it is lost from corruption or deletion. • Second purpose is to recover data from an earlier time. What is Database recovery techniques Recovery techniques are used to ensure database consistency and transaction automaticity and durability despite failures. Why recovery is needed? (What causes a Transaction to fail?) There are several reasons that could cause a transaction to fail in the middle of execution 1. A computer failure (system crash): A hardware or software error occurs in the computer system during transaction execution. If the hardware crashes, the contents of the computer’s internal memory may be lost. 2. A transaction or system error : Some operation in the transaction may cause it to fail, such as integer overflow or division by zero. Transaction failure may also occur because of a logical programming error. In addition, the user may interrupt the transaction during its execution. 3. Local errors or exception conditions detected by the transaction. 4. Disk failure: Some disk blocks may lose their data because of a disk read/write head crash. This may happen during a read or a write operation of the transaction. 5. Physical problems and catastrophes: This refers to an endless list of problems that includes power or air-conditioning failure, fire, theft, sabotage, overwriting disks or tapes by mistake, and mounting of a wrong tape by the operator. There are many different approaches to recover a database: Manual reprocessing & a variety of automated recovery techniques. 1. Manual Reprocessing The database is periodically backed up (a database save) and all transactions applied since the last save are recorded. If the system crashes, the latest database save is restored and all of the transactions are re-applied (by users) to bring the database back up to the point just before the crash. Limitations: • Time required to reapply transactions • Transactions might have other (physical) potential failures • Reapplying concurrent transactions is not straight forward. 2. Automated Recovery There are several types of automated recovery techniques including: Deferred update, Immediate update, Shadow paging, etc. 1
  • 2. A transaction can be in one of the following states: • Active - when the transaction just begins • Partially Committed - after the last operation has completed (but before the commit point is reached) • Failed - Normal operation is prevented (e.g., in the event of a system crash) • Aborted - Transaction is rolled back. That is, all of its effects are undone • Committed - Transaction completes all operations and moved the database to the next consistent state The System Log To be able to recover from failures that affect transactions, the system maintains a log to keep track of all transactions that affect the values of database items. Each transaction writes the following information to the log: • Start(T) - the fact that transaction T has started • Write(T, X, old_value, new_value) - the fact that transaction T has written to item X with the new_value. old_value is also maintained. • Read(T,X)-the fact that transaction T has read data item X either: Commit(T)-transaction T committed or Abort(T) - transaction T was aborted Recovery techniques use the following operations: UNDO (Backward Recovery): Similar to rollback except that it applies to a single operation rather than to a whole transaction. REDO (Forward Recovery): This specifies that certain transaction operations must be redone to ensure that all the operations of a committed transaction have been applied successfully to the database. The 3 Important Recovery Techniques from transaction failures: 1. Deferred Update Recovery: Also called NO-UNDO, REDO Technique This technique defers or postpones any actual updates to the database until the transaction reaches it commit point. • During transaction execution, the updates are written to the log file. • After the transaction reaches it commit point, the log file is force-written to disk, then the updates are recorded in the database. • If the 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 in any way. • REDO may be necessary. A typical deferred update protocol uses the following rules: 2
  • 3. 1. A transaction cannot change the database on disk until it reaches its commit point. 2. A transaction does not reach its commit point until all its update operations are recorded in the log file and the log file is force-written to disk. 3. Because the database is never updated on disk until after the transactions commits, there is never the need to UNDO any operations. That’s why a recovery techniques based on deferred update are therefore known as NO UNDO, REDO techniques. Example: T1: Ra Rd Wd C T2: Rb Wb Rd Wd C T3: Ra Wa Rc Wc C T4: Rb Wb Ra Wa C Log file: Start(T1) Write(T1, d, old, new) Commit(T1) Start(T4) Write(T4, b, old, new) Write(T4, a, old, new) Commit(T4) Start(T2) Write(T2, b, old, new) Start(T3) Write(T3, a, old, new) s y s t e m c r a s h Since T1 and T4 committed, their changes were written to disk. However, T2 and T3 did not commit, hence their changes were not written to disk. To recover, we simply ignore those transactions that did not commit. Advantages: • Recovery is made easier. • Any transaction that reached the commit point (from the log) has its writes applied to the database. • All other transactions are ignored. • Cascading rollback does not occur because no other transaction sees the work of another until it is committed. Disadvantages: Concurrency is limited: Must employ Strict 2PL which limits concurrency. 2. Immediate Update Recovery: also called (UNDO, NO-REDO) • The database is physically updated before the transaction reaches to its commit point. • UNDO may be necessary when a transaction fails. 3
  • 4. • REDO is not needed. A typical deferred update protocol uses the following rules: 1. In immediate update techniques, although the database can be updated immediately, update operations must be recorded in the log (on disk) before being applied to the database. 2. There is never a need to REDO any operations of committed transactions (this is called the UNDO/NO-REDO recovery algorithm). 3. The effect of all active transactions at the time of failure must be undone. Advantages: Immediate update allows higher concurrency because transactions write continuously to the database rather than waiting until the commit point. Disadvantages: Step 2 above can lead to cascading rollbacks - time consuming and may be problematic. 3. Shadow paging • Is a technique for providing automaticity and durability properties related to transaction control. • This technique does not require the use of a log in a single-user environment. In a multiuser environment, a log may be needed for the concurrency control method. • Shadow paging considers the database to be made up of a number of fixed size disk pages (or disk blocks)—say, n—for recovery purposes. A directory(page table) with n entries is constructed, where the ith entry points to the ith database page on disk. • The idea is to maintain 2 directories (page tables) during the lifetime of a transaction, Current directory & the Shadow directory. • The directory is kept in main memory if it is not too large, and all references—reads or writes—to database pages on disk go through it. • Initially both the directories are identical. Only current directory is used for data item accesses during execution of the transaction. • Whenever any page is about to be written for the first time-a copy of this page is made on to an unused page. • When a transaction begins executing, the current directory—whose entries point to the most recent or current database pages on disk—is copied into a shadow directory. The 4
  • 5. shadow directory is then saved on disk while the current directory is used by the transaction. The figure below illustrates the use of Shadow paging techniques: Advantages: • The overhead of maintaining the transaction log file is eliminated. • Since there is no need for undo or redo operations, recovery is significantly fast. Disadvantages: • Copying the entire page table is very expensive. • Complex storage management strategies. 5
  • 6. shadow directory is then saved on disk while the current directory is used by the transaction. The figure below illustrates the use of Shadow paging techniques: Advantages: • The overhead of maintaining the transaction log file is eliminated. • Since there is no need for undo or redo operations, recovery is significantly fast. Disadvantages: • Copying the entire page table is very expensive. • Complex storage management strategies. 5