SlideShare a Scribd company logo
1 of 6
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

What's hot

Topic 4 database recovery
Topic 4 database recoveryTopic 4 database recovery
Topic 4 database recoveryacap paei
 
Database recovery
Database recoveryDatabase recovery
Database recoveryStudent
 
17. Recovery System in DBMS
17. Recovery System in DBMS17. Recovery System in DBMS
17. Recovery System in DBMSkoolkampus
 
Recovery Techniques and Need of Recovery
Recovery Techniques and   Need of RecoveryRecovery Techniques and   Need of Recovery
Recovery Techniques and Need of RecoveryPooja Dixit
 
recovery system
recovery systemrecovery system
recovery systemshreeuva
 
Recovery system
Recovery systemRecovery system
Recovery systemRakesh S
 
Transaction & Concurrency Control
Transaction & Concurrency ControlTransaction & Concurrency Control
Transaction & Concurrency ControlRavimuthurajan
 
Operating Systems: Processor Management
Operating Systems: Processor ManagementOperating Systems: Processor Management
Operating Systems: Processor ManagementDamian T. Gordon
 
Lesson12 recovery architectures
Lesson12 recovery architecturesLesson12 recovery architectures
Lesson12 recovery architecturesRaval Vijay
 
Ch17 introduction to transaction processing concepts and theory
Ch17 introduction to transaction processing concepts and theoryCh17 introduction to transaction processing concepts and theory
Ch17 introduction to transaction processing concepts and theorymeenatchi selvaraj
 
Backing Up and Recovery
Backing Up and RecoveryBacking Up and Recovery
Backing Up and RecoveryMaham Huda
 
Real Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded SystemsReal Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded SystemsAditya Vichare
 
CS 542 -- Failure Recovery, Concurrency Control
CS 542 -- Failure Recovery, Concurrency ControlCS 542 -- Failure Recovery, Concurrency Control
CS 542 -- Failure Recovery, Concurrency ControlJ Singh
 
Database backup and recovery
Database backup and recoveryDatabase backup and recovery
Database backup and recoveryAnne Lee
 

What's hot (20)

Topic 4 database recovery
Topic 4 database recoveryTopic 4 database recovery
Topic 4 database recovery
 
Database recovery
Database recoveryDatabase recovery
Database recovery
 
Recovery system
Recovery systemRecovery system
Recovery system
 
17. Recovery System in DBMS
17. Recovery System in DBMS17. Recovery System in DBMS
17. Recovery System in DBMS
 
Recovery Techniques and Need of Recovery
Recovery Techniques and   Need of RecoveryRecovery Techniques and   Need of Recovery
Recovery Techniques and Need of Recovery
 
Aries
AriesAries
Aries
 
Unit 07 dbms
Unit 07 dbmsUnit 07 dbms
Unit 07 dbms
 
recovery system
recovery systemrecovery system
recovery system
 
Recovery system
Recovery systemRecovery system
Recovery system
 
Transaction & Concurrency Control
Transaction & Concurrency ControlTransaction & Concurrency Control
Transaction & Concurrency Control
 
Operating Systems: Processor Management
Operating Systems: Processor ManagementOperating Systems: Processor Management
Operating Systems: Processor Management
 
Lesson12 recovery architectures
Lesson12 recovery architecturesLesson12 recovery architectures
Lesson12 recovery architectures
 
4 db recovery
4 db recovery4 db recovery
4 db recovery
 
Ch17 introduction to transaction processing concepts and theory
Ch17 introduction to transaction processing concepts and theoryCh17 introduction to transaction processing concepts and theory
Ch17 introduction to transaction processing concepts and theory
 
Backing Up and Recovery
Backing Up and RecoveryBacking Up and Recovery
Backing Up and Recovery
 
Real Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded SystemsReal Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded Systems
 
CS 542 -- Failure Recovery, Concurrency Control
CS 542 -- Failure Recovery, Concurrency ControlCS 542 -- Failure Recovery, Concurrency Control
CS 542 -- Failure Recovery, Concurrency Control
 
Database backup and recovery
Database backup and recoveryDatabase backup and recovery
Database backup and recovery
 
Dbms
DbmsDbms
Dbms
 
Data (1)
Data (1)Data (1)
Data (1)
 

Similar to Database Backup & Recovery Techniques Explained

Databases: Backup and Recovery
Databases: Backup and RecoveryDatabases: Backup and Recovery
Databases: Backup and RecoveryDamian T. Gordon
 
ch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.pptch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.pptAdemeCheklie
 
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 theoryZainab Almugbel
 
UNIT 4- CRASH AND RECOVERY.pdf
UNIT 4- CRASH AND RECOVERY.pdfUNIT 4- CRASH AND RECOVERY.pdf
UNIT 4- CRASH AND RECOVERY.pdfKavitaShinde26
 
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptxUnit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptxKoteswari Kasireddy
 
Recovery System.pptx
Recovery System.pptxRecovery System.pptx
Recovery System.pptxssuserfb9a21
 
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptxDBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptxHemaSenthil5
 
Unit no 5 transation processing DMS 22319
Unit no 5 transation processing DMS 22319Unit no 5 transation processing DMS 22319
Unit no 5 transation processing DMS 22319ARVIND SARDAR
 
Transactionsmanagement
TransactionsmanagementTransactionsmanagement
TransactionsmanagementSanjeev Gupta
 
Presentation on Transaction
Presentation on TransactionPresentation on Transaction
Presentation on TransactionRahul Prajapati
 
Adbms 34 transaction processing and recovery
Adbms 34 transaction processing and recoveryAdbms 34 transaction processing and recovery
Adbms 34 transaction processing and recoveryVaibhav Khanna
 

Similar to Database Backup & Recovery Techniques Explained (20)

DBMS Vardhaman.pdf
DBMS Vardhaman.pdfDBMS Vardhaman.pdf
DBMS Vardhaman.pdf
 
Recovery techniques
Recovery techniquesRecovery techniques
Recovery techniques
 
Databases: Backup and Recovery
Databases: Backup and RecoveryDatabases: Backup and Recovery
Databases: Backup and Recovery
 
ch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.pptch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.ppt
 
ch-5 advanced db.pdf
ch-5 advanced db.pdfch-5 advanced db.pdf
ch-5 advanced db.pdf
 
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
 
UNIT 4- CRASH AND RECOVERY.pdf
UNIT 4- CRASH AND RECOVERY.pdfUNIT 4- CRASH AND RECOVERY.pdf
UNIT 4- CRASH AND RECOVERY.pdf
 
Dbms
DbmsDbms
Dbms
 
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptxUnit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
 
Recovery System.pptx
Recovery System.pptxRecovery System.pptx
Recovery System.pptx
 
2 recovery
2 recovery2 recovery
2 recovery
 
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptxDBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
 
DBMS UNIT IV.pptx
DBMS UNIT IV.pptxDBMS UNIT IV.pptx
DBMS UNIT IV.pptx
 
Unit no 5 transation processing DMS 22319
Unit no 5 transation processing DMS 22319Unit no 5 transation processing DMS 22319
Unit no 5 transation processing DMS 22319
 
Transactionsmanagement
TransactionsmanagementTransactionsmanagement
Transactionsmanagement
 
Presentation on Transaction
Presentation on TransactionPresentation on Transaction
Presentation on Transaction
 
Assignment#14
Assignment#14Assignment#14
Assignment#14
 
Tranasaction management
Tranasaction managementTranasaction management
Tranasaction management
 
Adbms 34 transaction processing and recovery
Adbms 34 transaction processing and recoveryAdbms 34 transaction processing and recovery
Adbms 34 transaction processing and recovery
 
Unit 4 dbms
Unit 4 dbmsUnit 4 dbms
Unit 4 dbms
 

More from Raj vardhan

Software Testing Life Cycle Unit-3
Software Testing Life Cycle Unit-3Software Testing Life Cycle Unit-3
Software Testing Life Cycle Unit-3Raj vardhan
 
Internet Basics Unit-7
Internet Basics  Unit-7Internet Basics  Unit-7
Internet Basics Unit-7Raj vardhan
 
Local Area Network – Wired LAN
Local Area Network – Wired LANLocal Area Network – Wired LAN
Local Area Network – Wired LANRaj vardhan
 
Network Connecting Devices UNIT 5
Network Connecting Devices UNIT 5Network Connecting Devices UNIT 5
Network Connecting Devices UNIT 5Raj vardhan
 
UNIT 4-HEADER FILES IN C
UNIT 4-HEADER FILES IN CUNIT 4-HEADER FILES IN C
UNIT 4-HEADER FILES IN CRaj vardhan
 
Wireless LANs(IEEE802.11) Architecture
Wireless LANs(IEEE802.11) Architecture Wireless LANs(IEEE802.11) Architecture
Wireless LANs(IEEE802.11) Architecture Raj vardhan
 
UNIT -03 Transmission Media and Connecting Devices
UNIT -03 Transmission Media and Connecting Devices UNIT -03 Transmission Media and Connecting Devices
UNIT -03 Transmission Media and Connecting Devices Raj vardhan
 
Unit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 CompleteUnit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 CompleteRaj vardhan
 
Introduction To Software Concepts Unit 1 & 2
Introduction To Software Concepts Unit 1 & 2Introduction To Software Concepts Unit 1 & 2
Introduction To Software Concepts Unit 1 & 2Raj vardhan
 
Swachh Bharat Abhiyan - Project Report
Swachh Bharat Abhiyan - Project ReportSwachh Bharat Abhiyan - Project Report
Swachh Bharat Abhiyan - Project ReportRaj vardhan
 
Network Topology
Network TopologyNetwork Topology
Network TopologyRaj vardhan
 
Microsoft Office Word Introduction Complete
Microsoft Office Word  Introduction CompleteMicrosoft Office Word  Introduction Complete
Microsoft Office Word Introduction CompleteRaj vardhan
 
Digital money Revolution Introduction
Digital money Revolution IntroductionDigital money Revolution Introduction
Digital money Revolution IntroductionRaj vardhan
 
Definition of Business
Definition of BusinessDefinition of Business
Definition of BusinessRaj vardhan
 
Business Terms & Concepts
Business Terms & ConceptsBusiness Terms & Concepts
Business Terms & ConceptsRaj vardhan
 
Number System Conversion | BCA
Number System Conversion | BCANumber System Conversion | BCA
Number System Conversion | BCARaj vardhan
 
Interaction With Computers FIT
Interaction With Computers FITInteraction With Computers FIT
Interaction With Computers FITRaj vardhan
 
FIT-MS-WORD Lab | BCA
FIT-MS-WORD Lab | BCAFIT-MS-WORD Lab | BCA
FIT-MS-WORD Lab | BCARaj vardhan
 
Syllabus Front End Design Tool VB.NET | BCA-205
Syllabus Front End Design Tool VB.NET | BCA-205 Syllabus Front End Design Tool VB.NET | BCA-205
Syllabus Front End Design Tool VB.NET | BCA-205 Raj vardhan
 

More from Raj vardhan (20)

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

Recently uploaded

Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 

Recently uploaded (20)

Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 

Database Backup & Recovery Techniques Explained

  • 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