Database Recovery Techniques in DBMS
Database Recovery Techniques in DBMS
Recovery techniques impact performance through resource consumption; transaction logging and checkpointing incur runtime overhead by ensuring state snapshots and recovery info. Increased storage for logs/checkpoints and CPU cycles for processing pre-emptive safety measures can elevate operational costs. Balancing these with reduced downtime justifies expenses by preventing data loss .
Transaction states are critical as they determine recovery actions post-failure. Active and failed transactions are undone, affecting database consistency. Handled through transaction logs, databases log checkpoints or abort transactions to maintain pre-failure consistency. Committed or pre-commit transactions are re-applied if needed, ensuring data integrity sustains over failures .
UNDO operations revert faulty transactions by reversing their effects: deleting inserted data, reinserting deleted items, and overwriting updated values with pre-update logs. REDO operations restore valid transactions impacted by faulty ones using logs to replicate insertions, deletions, or updates. These steps collectively revert undesirable changes while retaining intended database states post-recovery .
A combination of recovery techniques like UNDO/REDO operations, checkpointing, and use of transaction logs is preferred because each method addresses different failure aspects, ensuring comprehensive recovery. Soft errors need undo/redo, while hard failures require full database restoration. This synergy provides robust protection against diverse failure conditions, enhancing data integrity and minimizing downtime .
Transaction logs are crucial for recovery from disk failures, as they track transaction activity. Both immediate and deferred update modes use logs to redo committed transactions and write them to the commit list, while undoing and logging those in active and failed lists to the abort list. This ensures that all completed transactions are recovered, and incomplete transactions are aborted .
Checkpointing reduces recovery time by ensuring that only transactions after the last checkpoint are redone or undone, as earlier transactions are committed. Consistent checkpointing suspends active transactions, writes all buffer changes to disk, logs the checkpoint, and resumes transactions. Fuzzy checkpointing logs all active transactions during the checkpoint but only processes post-checkpoint and failure transactions during recovery .
Recovery management evolves by embracing scalable techniques fitting distributed databases' need for consistency across nodes. Techniques enhance concurrency control via timestamps or MVCC, shrinking recovery time and handling vast transaction logs efficiently, tailoring for cloud-based nodes. Exponential storage growth demands refining checkpoint/log management to sustain low-latency uninterrupted service .
During power failures, recovery mechanisms differ based on the update mode. In immediate update mode, the recovery manager undoes transactions in active and failed lists, writes them on the abort list, and redoes transactions in the before-commit list. In deferred update mode, it writes transactions in active and failed lists to the abort list with no undo operations, and redoes transactions in the before-commit list .
Distributed DBMSs use different strategies for database recovery depending on the type of failure. For soft failures, the system may use transaction undo or rollback to handle inconsistencies, or transaction redo to return to a consistent state. For hard failures, which involve extensive damage, the system restores the database using past backups and redoes operations of committed transactions to update to a current state .
Following a crash, the recovery sequence begins with checkpoint analysis. Transactions before a checkpoint are ignored if previously committed. Those spanning checkpoints need analysis: redo operations are applied if they committed post-checkpoint and undos for those active soon after the crash. This efficiently restores database state to pre-crash consistency .