ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Advance Database Management Systems
    COMP3146
    Progress0 / 18 topics
    Topics
    1. Introduction to advance data models such as object relational, object oriented2. File organizations concepts3. Transactional processing4. Concurrency control techniques5. Recovery techniques6. Query processing and optimization7. Database Programming (PL/SQL)8. Database Programming (T-SQL)9. Database Programming (similar technology)10. Integrity and security11. Database Administration (Role management)12. Database Administration (managing database access)13. Database Administration (views)14. Physical database design and tuning15. Distributed database systems16. Emerging research trends in database systems17. MONGO DB18. NO SQL (or similar technologies)
    COMP3146›Recovery techniques
    Advance Database Management SystemsTopic 5 of 18

    Recovery techniques

    3 minread
    593words
    Beginnerlevel

    🛠️ Recovery Techniques in Database Systems


    🔰 What is Recovery?

    Recovery in DBMS refers to the process of restoring the database to a correct state after a failure such as:

    • System crash
    • Transaction failure
    • Media failure (disk crash)
    • Power failure

    The aim is to ensure data integrity and durability by preserving the effects of committed transactions and undoing uncommitted ones.


    🔑 Important Concepts

    • Failure Types:

      • Transaction failure: Logical errors or violation of integrity constraints.
      • System crash: Power failure, OS crash.
      • Media failure: Hardware damage to storage.
    • Recovery Manager: A DBMS component responsible for recovery operations.


    ✅ Key Recovery Techniques

    1. Deferred Update (No-Force, Steal Policy)

    • Changes made by a transaction are kept in memory and written to disk only after the transaction commits.
    • No updates are written to disk before commit.
    • If failure occurs before commit, no undo is required because changes are not saved.

    Advantages:

    • Simple recovery (only redo needed).
    • Avoids unnecessary disk writes.

    Disadvantages:

    • Recovery time can be long because all updates since last checkpoint must be redone.

    2. Immediate Update (Force, No-Steal Policy)

    • Updates can be written to disk before transaction commits.
    • If a transaction fails, DBMS must undo its changes from the disk.

    Advantages:

    • Changes are on disk quickly, improving durability.

    Disadvantages:

    • Recovery requires both undo and redo operations.
    • Requires a robust logging mechanism.

    3. Write-Ahead Logging (WAL) Protocol

    A fundamental technique used by most DBMSs for recovery.

    • Before any data item is written to disk, its before-image and after-image must be recorded in the log.
    • The log is stored on stable storage.

    Types of Log Records:

    • Update record: Contains before and after values of a data item.
    • Commit record: Marks transaction commit.
    • Abort record: Marks transaction abort.

    Properties:

    • Guarantees atomicity and durability.
    • Supports undo and redo operations.

    4. Checkpointing

    • Periodic process of writing the current state of the database and log to stable storage.
    • Reduces recovery time by limiting how far back the system needs to scan the log.

    Types:

    • Fuzzy Checkpoint: Database continues processing transactions during checkpoint.
    • Consistent Checkpoint: All transactions paused during checkpoint.

    5. Undo and Redo Operations

    Operation Purpose
    Undo Revert changes of uncommitted transactions to maintain atomicity.
    Redo Reapply changes of committed transactions that might not have been written to disk.

    6. Shadow Paging

    • The database keeps two page tables: current and shadow.
    • All updates are made to the current page table.
    • When transaction commits, current page table replaces shadow page table.
    • On failure, shadow page table is used to restore the database.

    Advantages:

    • Simple recovery (just discard current page table on failure).

    Disadvantages:

    • Inefficient for high update workloads.
    • Requires large memory for page tables.

    📝 Recovery Algorithm Example: ARIES (Algorithms for Recovery and Isolation Exploiting Semantics)

    ARIES is a widely used recovery method based on:

    • Write-Ahead Logging (WAL)
    • Repeating History during redo
    • Logging logical undo operations

    Phases:

    1. Analysis: Identify dirty pages and active transactions.
    2. Redo: Reapply all changes from the log.
    3. Undo: Rollback incomplete transactions.

    🛡️ Summary Table of Recovery Techniques

    Technique Description Undo Required Redo Required Disk Writes Timing
    Deferred Update Updates written after commit No Yes After commit
    Immediate Update Updates can be written anytime Yes Yes Before or after commit
    Write-Ahead Logging Log before data write Yes Yes Before data write
    Checkpointing Periodic saving of DB state N/A N/A N/A
    Shadow Paging Keep shadow copies of data pages No No At commit

    💡 Why Recovery Techniques Matter?

    • Ensure database consistency and durability despite failures.
    • Provide support for transaction atomicity.
    • Minimize system downtime and data loss.
    • Crucial for mission-critical applications (banking, airline reservation).

    Previous topic 4
    Concurrency control techniques
    Next topic 6
    Query processing and optimization

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time3 min
      Word count593
      Code examples0
      DifficultyBeginner