UNIT IV Notes-1
UNIT IV Notes-1
System Log
How System Logs and System Records Aid in Data Recovery
System logs and records are essential for recovering lost data in
transactions, particularly in the event of system crashes, application
failures, or other unexpected interruptions. Here's how they
contribute to recovery:
1. Rollback Mechanism
• Use of Logs: When a transaction fails or is explicitly rolled
back, the log can be used to revert the database to its
previous state. The log will contain all the operations that
were performed by the transaction, allowing the system to
undo those changes.
• Example: If a transaction updates several records but
encounters an error before committing, the system can refer
to the log to revert those updates, ensuring the database
remains consistent.
2. Redo Mechanism
• Use of Logs: After a crash, committed transactions need to be
reapplied (redone) to ensure all changes are preserved. The
log helps in identifying which transactions were committed
before the failure and need to be reapplied.
• Example: If a transaction successfully updates data but the
system crashes before the update is saved, the log will
indicate the changes made. Upon recovery, the system can
redo these changes to restore the last consistent state.
3. Point-in-Time Recovery
• Use of System Records: System records can provide a snapshot
of the database at specific points in time. This is useful for
recovering the database to a known good state.
• Example: If data corruption occurs due to an erroneous
transaction, the system can revert to the last stable snapshot,
minimizing data loss.
4. Consistency and Integrity Maintenance
• Both logs and records ensure that the database maintains
consistency and integrity through various recovery strategies.
By tracking the sequence of operations, they help prevent
anomalies that could arise from incomplete transactions or
concurrent operations.