Title Goes Here - Binus Repository

Download Report

Transcript Title Goes Here - Binus Repository

Matakuliah
Tahun
: M0264/Manajemen Basis Data
: 2008
Manajemen Basis Data
Pertemuan 6
Objectives
• The Log
• Database Recovery (Pemulihan Kerusakan)
• Media Recovery (Media Pemulihan)
Bina Nusantara
The Log
• The following actions are recorded in the log:
–
Ti writes an object: the old value and the new value.
• Log record must go to disk before the changed page!
–
Ti commits/aborts: a log record indicating this action.
• Log records are chained together by Xact id, so it’s easy to undo a
specific Xact.
• Log is often duplexed and archived on stable storage.
• All log related activities (and in fact, all CC related activities such as
lock/unlock, dealing with deadlocks etc.) are handled transparently
by the DBMS.
Bina Nusantara
The Log
• A log record is written for each of the following actions :
–
–
–
–
–
Bina Nusantara
Updating a page
Commit
Abort
End
Undoing an update
Database Recovery
• Recovery Control
–
–
–
–
Bina Nusantara
Some causes of database failure.
Purpose of transaction log file.
Purpose of checkpointing.
How to recover following database failure.
Database Recovery
Process of restoring database to a correct state in the
event
of a failure.
• Need for Recovery Control
– Two types of storage: volatile (main memory) and nonvolatile.
– Volatile storage does not survive system crashes.
– Stable storage represents information that has been replicated in
several nonvolatile storage media with independent failure modes.
Bina Nusantara
Database Recovery
• Types of Failures
– System crashes, resulting in loss of main memory.
– Media failures, resulting in loss of parts of secondary storage.
– Application software errors.
– Natural physical disasters.
– Carelessness or unintentional destruction of data or facilities.
– Sabotage.
Bina Nusantara
Database Recovery
• DBMS should provide following facilities to assist
with recovery:
– Backup mechanism, which makes periodic backup copies of
database.
– Logging facilities, which keep track of current state of
transactions and database changes.
– Checkpoint facility, which enables updates to database in
progress to be made permanent.
– Recovery manager, which allows DBMS to restore database
to consistent state following a failure.
Bina Nusantara
Media Recovery
• Media recovery is based on periodically making copy of
the database.
• Because copying a large database object such as a file
can take a long time and the DBMS must be allowed to
continue with its operation in the meantime, creating a
copy is handled in manner similar to taking a fuzzy
checkpoint.
Bina Nusantara