Upload
rafiullah-kaki
View
57
Download
6
Tags:
Embed Size (px)
Citation preview
© Copyright 2008 STI - INNSBRUCK www.sti-innsbruck.at
Presentation of Advance Database
onConcurrenccy Control & DB Recovery
University of MalakandDepartment of Software Engineering
Rafi Ullah&
Fazli Mola Jan
Designed and Prepared by Rafi Uah & Fazli Mola Jan
Chapter 12 © 2007 by Prentice Hall 2
Database Recovery
Mechanism for restoring a database quickly and accurately after loss or damage
Recovery facilities:• Backup Facilities• Journalizing Facilities• Checkpoint Facility• Recovery Manager
Chapter 12 © 2007 by Prentice Hall 3
Back-up Facilities Automatic dump facility that
produces backup copy of the entire database
Periodic backup (e.g. nightly, weekly)
Backups stored in secure, off-site location
Chapter 12 © 2007 by Prentice Hall 4
Checkpoint Facilities
DBMS periodically refuses to accept new transactions
system is in a quiet simple Database and transaction logs are
synchronizedThis allows recovery manager to resume processing from short period, instead of repeating entire day
Chapter 12 © 2007 by Prentice Hall 5
Concurrency Control Problem–in a multiuser
environment, simultaneous access to data can result in interference and data loss
Solution–Concurrency Control The process of managing
simultaneous operations against a database so that data integrity is maintained and the operations do not interfere with each other in a multi-user environment
Chapter 12 © 2007 by Prentice Hall 6
Concurrency Control
Process of managing simultaneous execution of transactions in a shared database, to ensure the serializability of transactions, is known as concurrency control.
Chapter 12 © 2007 by Prentice Hall 7
Concurrency Control Techniques
Pessimistic concurrency control Optimistic concurrency control
Chapter 12 © 2007 by Prentice Hall 8
Pessimistic Concurrency Control
• Pessimistic Concurrency Control assumes that conflicts will happen
• Pessimistic Concurrency Control techniques detect conflicts as soon as they occur and resolve them using blocking.
Chapter 12 © 2007 by Prentice Hall 9
Optimistic Concurrency Control
• Optimistic Concurrency Control assumes that conflicts between transactions are rare.
• Does not require locking• Transaction executed without
restrictions
Chapter 12 © 2007 by Prentice Hall 10
Concurrency Control Techniques
Serializability Finish one transaction before starting
another Locking Mechanisms
The most common way of achieving serialization
Data that is retrieved for the purpose of updating is locked for the updater
No other user can perform update until unlocked
Chapter 12 © 2007 by Prentice Hall 11
Locking Mechanisms Locking level:
Database–The entire database is locked and become unavailable to other users.This is used during the backup of the entire Database.
Table–The entire Table containing a requested record is locked
Page–very commonly used Record–only the requested row is locked;
fairly commonly used Field–only particular field or column is
locked; impractical
Chapter 12 © 2007 by Prentice Hall 12
Locking Mechanisms
Types of locks: Shared lock–Read but no update permitted.
Exclusive lock–No access permitted. Used when preparing to update
Questions with in the Presentation?
13