13
© Copyright 2008 STI - INNSBRUCK www.sti- innsbruck.at Presentation of Advance Database on Concurrenccy Control & DB Recovery University of Malakand Department of Software Engineering Rafi Ullah & Fazli Mola Jan Designed and Prepared by Rafi Uah & Fazli Mola Jan

Fazal rafi.. database concurancy control and recovery

Embed Size (px)

Citation preview

Page 1: Fazal rafi.. database concurancy control and recovery

© 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

Page 2: Fazal rafi.. database concurancy control and recovery

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

Page 3: Fazal rafi.. database concurancy control and recovery

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

Page 4: Fazal rafi.. database concurancy control and recovery

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

Page 5: Fazal rafi.. database concurancy control and recovery

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

Page 6: Fazal rafi.. database concurancy control and recovery

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.

Page 7: Fazal rafi.. database concurancy control and recovery

Chapter 12 © 2007 by Prentice Hall 7

Concurrency Control Techniques

Pessimistic concurrency control Optimistic concurrency control

Page 8: Fazal rafi.. database concurancy control and recovery

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.

Page 9: Fazal rafi.. database concurancy control and recovery

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

Page 10: Fazal rafi.. database concurancy control and recovery

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

Page 11: Fazal rafi.. database concurancy control and recovery

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

Page 12: Fazal rafi.. database concurancy control and recovery

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

Page 13: Fazal rafi.. database concurancy control and recovery

Questions with in the Presentation?

13