Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Recovery Recovery Buffer Management Recovery Facilities

Similar presentations


Presentation on theme: "Database Recovery Recovery Buffer Management Recovery Facilities"— Presentation transcript:

1 Database Recovery Recovery Buffer Management Recovery Facilities
Recover Techniques Chapter 22.3(20.3)

2 Recovery(1) Recovery:Restoring the database to a correct state in the event of a failure Storage device: memory, Disk, Tape (or other offline storage) Failure system crashes: memory loss media failures: parts of disk loss application software errors:one or more transactions fail disasters and carelessness Sabotage (惡意破壞)

3 Recovery(2) Objective:guarantee atomicity and durability
Write: Write to Buffer then flush to disk Transaction committed: redo(rollforward) Transaction uncomitted:undo(rollback)

4 Buffer Management Write back policy
steal policy:allows write back before commit force policy:all page updated write back immediately when commit no-steal policy need very large buffer force policy has lower efficiency most DBMS employ steal,no-force policy

5 Recovery Facilities(1)
backup mechanism full or incremental store backup on offline storage logging facilities DBMS maintains a special file called a log or journal contains info about all updates log contains:Transaction and checkpoint records Fig. 22(20).25,may contain other info for management maybe 2 or 3 copies,store on separated disk log file may be bottleneck of DBMS

6 Recovery Facilities(2)
checkpoint facility how far the log file need to be traced back when failure occurs use checkpointing to limit the amount of searching and processing on log file. checkpoint: the point of synchronization between DB and log. All buffers are flush to Disk. once per min. redo Transactions after CP, undo Transactions when failure occure recovery manager

7 Recover Techniques extensively damaged:restore backup data and redo transactions on log file inconsistent:use undo and redo deferred update:write to log file until commited then write into DB by using log records only redo is needed, can redo any times immediate update:write-ahead log protocol need redo and undo(reverse order) Shadow paging:use current and shadow page, not log file system

8 Example PostgreSQL MySQL
MySQL prevention.html


Download ppt "Database Recovery Recovery Buffer Management Recovery Facilities"

Similar presentations


Ads by Google