Professional Documents
Culture Documents
Database Lecture11
Database Lecture11
Database Lecture11
DATABASE
RECOVERY ALGORITHMS
Recovery algorithms are techniques to ensure database consistency and
transaction atomicity and durability despite failures.
• Focus of this chapter
Recovery algorithms have two parts:
1. Actions taken during normal transaction processing to
ensure enough information exists to recover from failures.
2. Actions taken after a failure to recover the database contents
to a state that ensures atomicity, consistency and durability.
5
STORAGE STRUCTURE
(A)
DB2 TRANSACTION LOGS
• Once the record has been modified or inserted, a record reflecting the change is written to the log buffer,
which is another storage area in memory (B)
• DB2 constantly checks to see if the log buffer is full, if MINCOMMIT commits have been performed, or if one
second has lapsed. If any of these factors have occurred, the information in the log buffers is written to the log
file on disk. (C)
• During a data recovery process, DB2 uses the log files to decide what changes to redo or undo.
(B)
(A) (C)
LOG FILE STATES 10
LOG FILE STATES
There are three states for a log file.
Offline archive logs are similar to online archive logs, except they are stored in a separate repository.
This is to save file system and disk drive space. Like the online archive logs, offline archive logs are used
in roll forward
recovery.
STABLE-STORAGE
IMPLEMENTATION
• Maintain multiple copies of each block on separate disks
• copies can be at remote sites to protect against disasters such as fire or flooding.
• Failure during data transfer can still result in inconsistent copies: Block transfer can result in
• Successful completion
• Partial failure: destination block has incorrect information
• Total failure: destination block was never updated
• Protecting storage media from failure during data transfer (one solution):
• Execute output operation as follows (assuming two copies of each block):
1. Write the information onto the first physical block.
2. When the first write successfully completes, write the same information onto the second physical block.
3. The output is completed only after the second write successfully completes.
LOGGING STRATEGIES 14
LOGGING STRATEGIES 15
LOGGING STRATEGIES
16
DATABASE BACKUP
18
DATABASE BACKUP
19
DATABASE BACKUP
20
DATABASE BACKUP
DATABASE BACKUP
21
22
DATABASE BACKUP
DATABASE BACKUP
23
24
DATABASE BACKUP
25
DATABASE RECOVERY
26
DATABASE RECOVERY
27
DATABASE RECOVERY
28
DATABASE RECOVERY
REFERENCES
Database System Concepts - 6th Edition
©Silberschatz, Korth and Sudarshan
DB2 Example
END OF
LECTURE 11