Upload
gladys-bruce
View
216
Download
0
Embed Size (px)
Citation preview
Database RecoveryDatabase Recovery
Lucas FingerLucas Finger
OverviewOverview
Purpose of RecoveryPurpose of Recovery
What Causes Database Failure?What Causes Database Failure?
Being PreparedBeing Prepared
Techniques for RecoveryTechniques for Recovery
Purpose of Database RecoveryPurpose of Database Recovery
To bring the database into the last To bring the database into the last consistent state, which existed prior consistent state, which existed prior to the failure.to the failure.To preserve transaction properties:To preserve transaction properties: AtomicityAtomicity ConsistencyConsistency IsolationIsolation DurabilityDurability
What Causes Database Failure?What Causes Database Failure?
DB server computer or program crashesDB server computer or program crashes
DB client computer or program crashesDB client computer or program crashes
Network failure between client and serverNetwork failure between client and server
Data on a disk drive is corruptedData on a disk drive is corrupted
A transaction executes an illegal operationA transaction executes an illegal operation
Two or more transactions deadlockTwo or more transactions deadlock
Transactions introduce errors into the DBTransactions introduce errors into the DB
Being PreparedBeing Prepared
Planning ahead is the most important Planning ahead is the most important aspect of data recovery.aspect of data recovery.
What to think about:What to think about: How much can you afford to lose?How much can you afford to lose? How and where backups are storedHow and where backups are stored Having a written planHaving a written plan Make sure it works!Make sure it works!
Recovery StrategiesRecovery Strategies
Redundancy is the key to recoveryRedundancy is the key to recovery
Tools:Tools: Backups, checkpoints, and transaction logsBackups, checkpoints, and transaction logs
Count Transaction Last Next Action Data Item Before After
1 T1 0 2 Begin
2 T1 1 4 W X X=100 X=200
3 T2 0 9 Begin
4 T1 2 5 W Y Y=50 Y=100
5 T1 4 7 R M M=200 M=200
6 T3 0 8 R N N=400 N=400
7 T1 5 null End
Recovery StrategiesRecovery Strategies
Types of Transaction LogsTypes of Transaction Logs Redo LogRedo Log
List of all changes in the order they were committedList of all changes in the order they were committed
‘‘recovery and roll forward’recovery and roll forward’
Mostly used for catastrophic failuresMostly used for catastrophic failures Undo LogUndo Log
List of all changes in reverse orderList of all changes in reverse order
‘‘roll back’roll back’
Often more efficient than recovery and roll forwardOften more efficient than recovery and roll forward
ConclusionConclusion
Data recovery is important in managing a Data recovery is important in managing a database system.database system.
Having a good plan will help make a quick Having a good plan will help make a quick and successful recovery from a failure.and successful recovery from a failure.
Backups and checkpoints together with Backups and checkpoints together with transaction logs help ensure your data is transaction logs help ensure your data is safe.safe.
ReferencesReferences
Kumar, Vijay, and Meichun Hsu. Kumar, Vijay, and Meichun Hsu. Recovery Mechanisms Recovery Mechanisms in Database Systems.in Database Systems. New Jersey: Prentice New Jersey: Prentice
Hall, Hall, 1998. 6-50.1998. 6-50.
Riccardi, Greg. Riccardi, Greg. Principles of Database Systems with Principles of Database Systems with Internet and Java ApplicationsInternet and Java Applications. Boston: Wesley . Boston: Wesley Publishing, 2001. 386-391.Publishing, 2001. 386-391.
Wynkoop, Stephen. “Data Recovery Best Practices.” Wynkoop, Stephen. “Data Recovery Best Practices.” Lumingent. 16 Dec 2004. Lumingent. 16 Dec 2004.
<http://www.lumigent.com/files/whitepaper_datareco<http://www.lumigent.com/files/whitepaper_datarecovery.pdf>very.pdf>
QUESTIONS?QUESTIONS?