SlideShare a Scribd company logo
CHAPTER 5
DATABASE TRANSACTION
MANAGEMENT
DFC2033 DATABASE SYSTEM
Course Learning Outcome
CLO2 : Develop a database using a
concurrency control and data recovery
technique to manage the database system.
Learning Outcome
¨  Describe the properties of database transaction:
a. Atomic
b. Consistent
c. Isolated
d. Durable
¨  Perform a transaction of a given database using SQL statements.
¨  Use START TRANSACTION and COMMIT statements.
¨  State the purpose of concurrency control.
¨  Explain the interference problems arise from simultaneous access to database:
a. Lost update
b. Uncommitted dependency
c. Inconsistent retrieval
¨  Describe the tools used by DBMS to prevent the interference problems : locks, Two-Phase
Locking (2PL) protocol.
¨  Describe the recovery tools:
a. Transaction log
b. Checkpoint
c. Database back-up
What is Transaction ?
¨  A transaction is a unit of work that should be
processed reliably without interference from other
users and without loss of data due to failures.
¨  Examples of transactions are withdrawing cash at
an ATM, making an airline reservation and
registering for a course.
Concurrency Control
¨  The purpose of concurrency control is to prevent
two different users (or two different connections by
the same user) from trying to update the same
data at the same time. Concurrency control can
also prevent one user from seeing out-of-date
data while another user is updating the same data.
Concurrency Control
The following examples explain why concurrency control is needed. For both examples,
suppose that your checking account contains $1,000. During the day you deposit $300 and
spend $200 from that account. At the end of the day your account should have $1,100.
¨  Example 1: No concurrency control
At 11:00 AM, bank teller #1 looks up your account and sees that you have $1,000. The
teller subtracts the $200 check, but is not able to save the updated account balance ($800)
immediately. At 11:01 AM, another teller #2 looks up your account and still sees the $1,000
balance. Teller #2 then adds your $300 deposit and saves your new account balance as
$1,300. At 11:09 AM, bank teller #1 returns to the terminal, finishes entering and saving
the updated value that is calculated to be $800. That $800 value writes over the $1300. At
the end of the day, your account has $800 when it should have had $1,100 ($1000 + 300 -
200).
¨  Example 2: Concurrency control
When teller #1 starts working on your account, a lock is placed on the account. When teller
#2 tries to read or update your account while teller #1 is updating your account, teller #2
will not be given access and gets an error message. After teller #1 has finished the update,
teller #2 can proceed. At the end of the day, your account has $1,100 ($1000 - 200 +
300).
Concurrency Control
Interference problem arise from simultaneous access
to database:
¨  Lost Update
¨  Uncommitted Dependency
¨  Inconsistent Retrieval
Lost Update
¨  Successfully completed update is overridden by
another user.
¨  Lost updates occur when two or more transactions
select the same row and then update the row
based on the value originally selected.
¨  Each transaction is unaware of other transactions.
The last updates overwrites updates made by the
other transactions which results in lost data.
Uncommitted Dependency
¨  Occurs when one transaction can see intermediate
results of another transaction before it has
committed.
¨  Uncommitted dependency occurs when a second
transaction selects a row that is being updated by
another transaction.
¨  The second transaction is reading data that has not
been committed yet and may be changed by the
transaction updating the row.
Inconsistent Retrieval
¨  Occurs when transaction reads several values but
second transaction updates some of them during
execution of first.
Database Concurrency Control
Two-Phase Locking Techniques -The algorithm
(a) Locking (Growing)
(b) Unlocking (Shrinking).
¨  Locking (Growing) Phase: A transaction applies locks (read
or write) on desired data items one at a time.
¨  Unlocking (Shrinking) Phase: A transaction unlocks its locked
data items one at a time.
Requirement:
For a transaction these two phases must be mutually exclusively,
that is, during locking phase unlocking phase must not start and
during unlocking phase locking phase must not begin.
Slide	
  18-­‐	
  18	
  
Deadlock
¨  Deadlock prevention
¤  A transaction locks all data items it refers to before it
begins execution.
¤  This way of locking prevents deadlock since a
transaction never waits for a data item.
¤  The conservative two-phase locking uses this approach.
Slide	
  18-­‐	
  19	
  
Deadlock
¨  Deadlock detection and resolution
¤  In this approach, deadlocks are allowed to happen. The
scheduler maintains a wait-for-graph for detecting cycle. If a
cycle exists, then one transaction involved in the cycle is selected
(victim) and rolled-back.
¤  A wait-for-graph is created using the lock table. As soon as a
transaction is blocked, it is added to the graph. When a chain
like: Ti waits for Tj waits for Tk waits for Ti or Tj occurs, then this
creates a cycle. One of the transaction o
Types of Recovery Tools
¨  Transaction Log
¤  A table that contains a history of database changes.
The recovery manager uses the log table to recover
from failures.
¨  Checkpoint
¤  The act of writing a checkpoint to log and writing log
and database buffer to disk.
¨  Database Backup
¤  A copy of all or part of disk. Is used when the disk
containing the database or log is damaged.

More Related Content

What's hot

Acid properties
Acid propertiesAcid properties
Acid properties
NomitaKumawat
 
Codd's rules
Codd's rulesCodd's rules
Codd's rulesMohd Arif
 
Transaction management and concurrency control
Transaction management and concurrency controlTransaction management and concurrency control
Transaction management and concurrency control
Dhani Ahmad
 
System calls
System callsSystem calls
System calls
Bernard Senam
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
madhav bansal
 
Query processing
Query processingQuery processing
Query processing
Dr. C.V. Suresh Babu
 
Distributed database management system
Distributed database management  systemDistributed database management  system
Distributed database management system
Pooja Dixit
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
Jargalsaikhan Alyeksandr
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
Sudarsun Santhiappan
 
Java Data Types
Java Data TypesJava Data Types
Java Data Types
Spotle.ai
 
Object Oriented Analysis Design using UML
Object Oriented Analysis Design using UMLObject Oriented Analysis Design using UML
Object Oriented Analysis Design using UML
Ajit Nayak
 
Homogeneous ddbms
Homogeneous ddbmsHomogeneous ddbms
Homogeneous ddbms
Pooja Dixit
 
Transaction management in DBMS
Transaction management in DBMSTransaction management in DBMS
Transaction management in DBMS
Megha Sharma
 
Overview of UML Diagrams
Overview of UML DiagramsOverview of UML Diagrams
Overview of UML Diagrams
Manish Kumar
 
protocols of concurrency control
protocols of concurrency controlprotocols of concurrency control
protocols of concurrency control
MOHIT DADU
 
Chapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management SystemChapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management System
Eddyzulham Mahluzydde
 
Introduction to Distributed System
Introduction to Distributed SystemIntroduction to Distributed System
Introduction to Distributed System
Sunita Sahu
 
Crash recovery in database
Crash recovery in databaseCrash recovery in database
Crash recovery in database
Prof.Nilesh Magar
 

What's hot (20)

Acid properties
Acid propertiesAcid properties
Acid properties
 
Codd's rules
Codd's rulesCodd's rules
Codd's rules
 
Transaction management and concurrency control
Transaction management and concurrency controlTransaction management and concurrency control
Transaction management and concurrency control
 
System calls
System callsSystem calls
System calls
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
Query processing
Query processingQuery processing
Query processing
 
Distributed database management system
Distributed database management  systemDistributed database management  system
Distributed database management system
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
 
Database System Architectures
Database System ArchitecturesDatabase System Architectures
Database System Architectures
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
Java Data Types
Java Data TypesJava Data Types
Java Data Types
 
Object Oriented Analysis Design using UML
Object Oriented Analysis Design using UMLObject Oriented Analysis Design using UML
Object Oriented Analysis Design using UML
 
Homogeneous ddbms
Homogeneous ddbmsHomogeneous ddbms
Homogeneous ddbms
 
Transaction management in DBMS
Transaction management in DBMSTransaction management in DBMS
Transaction management in DBMS
 
Deadlock ppt
Deadlock ppt Deadlock ppt
Deadlock ppt
 
Overview of UML Diagrams
Overview of UML DiagramsOverview of UML Diagrams
Overview of UML Diagrams
 
protocols of concurrency control
protocols of concurrency controlprotocols of concurrency control
protocols of concurrency control
 
Chapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management SystemChapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management System
 
Introduction to Distributed System
Introduction to Distributed SystemIntroduction to Distributed System
Introduction to Distributed System
 
Crash recovery in database
Crash recovery in databaseCrash recovery in database
Crash recovery in database
 

Viewers also liked

Transaction management
Transaction managementTransaction management
Transaction managementrenuka_a
 
Database chapter 10 questions
Database chapter 10 questionsDatabase chapter 10 questions
Database chapter 10 questionsjandrewsxu
 
Cursors, triggers, procedures
Cursors, triggers, proceduresCursors, triggers, procedures
Cursors, triggers, procedures
Vaibhav Kathuria
 
Oracle: Cursors
Oracle: CursorsOracle: Cursors
Oracle: Cursors
DataminingTools Inc
 
Transaction states PPT
Transaction states PPTTransaction states PPT
Transaction states PPT
Pondicherry Central University
 
Transaction states and properties
Transaction states and propertiesTransaction states and properties
Transaction states and properties
Chetan Mahawar
 
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
Beat Signer
 

Viewers also liked (8)

Transaction management
Transaction managementTransaction management
Transaction management
 
Database chapter 10 questions
Database chapter 10 questionsDatabase chapter 10 questions
Database chapter 10 questions
 
Cursors, triggers, procedures
Cursors, triggers, proceduresCursors, triggers, procedures
Cursors, triggers, procedures
 
Stored procedure
Stored procedureStored procedure
Stored procedure
 
Oracle: Cursors
Oracle: CursorsOracle: Cursors
Oracle: Cursors
 
Transaction states PPT
Transaction states PPTTransaction states PPT
Transaction states PPT
 
Transaction states and properties
Transaction states and propertiesTransaction states and properties
Transaction states and properties
 
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
 

Similar to Chapter 5 Database Transaction Management

Chapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlChapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlAbDul ThaYyal
 
Unit iv -Transactions
Unit iv -TransactionsUnit iv -Transactions
Unit iv -Transactions
Dhivyaa C.R
 
Transaction Processing Concept
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing Concept
Nishant Munjal
 
Concurrency Control.
Concurrency Control.Concurrency Control.
DBMS Presentation.pptx
DBMS Presentation.pptxDBMS Presentation.pptx
DBMS Presentation.pptx
PravinBhargav1
 
Transaction management and concurrency
Transaction management and concurrencyTransaction management and concurrency
Transaction management and concurrency
Venkata Sreeram
 
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
DrCViji
 
Database Transactions and SQL Server Concurrency
Database Transactions and SQL Server ConcurrencyDatabase Transactions and SQL Server Concurrency
Database Transactions and SQL Server Concurrency
Boris Hristov
 
TRANSACTION CONCEPTppt.pptx
TRANSACTION CONCEPTppt.pptxTRANSACTION CONCEPTppt.pptx
TRANSACTION CONCEPTppt.pptx
DummyTest9
 
CH09.ppt
CH09.pptCH09.ppt
CH09.ppt
ssuser5c874e
 
7. transaction mang
7. transaction mang7. transaction mang
7. transaction mang
khoahuy82
 
Dbms
DbmsDbms
transaction ,concurrency , and DDBMS
transaction ,concurrency , and DDBMStransaction ,concurrency , and DDBMS
transaction ,concurrency , and DDBMS
zahidHussain373
 
Concurrency note.pdf
Concurrency note.pdfConcurrency note.pdf
Concurrency note.pdf
BijayNag1
 
Distributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlDistributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency control
balamurugan.k Kalibalamurugan
 
Tybsc cs dbms2 notes
Tybsc cs dbms2 notesTybsc cs dbms2 notes
Tybsc cs dbms2 notes
Niraj Bharambe
 
Intro to tsql unit 12
Intro to tsql   unit 12Intro to tsql   unit 12
Intro to tsql unit 12Syed Asrarali
 
CONCURRENCY CONTOL notes.pdf
CONCURRENCY CONTOL notes.pdfCONCURRENCY CONTOL notes.pdf
CONCURRENCY CONTOL notes.pdf
BijayNag1
 

Similar to Chapter 5 Database Transaction Management (20)

Chapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlChapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency control
 
Unit iv -Transactions
Unit iv -TransactionsUnit iv -Transactions
Unit iv -Transactions
 
Transaction Processing Concept
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing Concept
 
Concurrency Control.
Concurrency Control.Concurrency Control.
Concurrency Control.
 
Transaction management transparencies
Transaction management transparenciesTransaction management transparencies
Transaction management transparencies
 
DBMS Presentation.pptx
DBMS Presentation.pptxDBMS Presentation.pptx
DBMS Presentation.pptx
 
Transaction management and concurrency
Transaction management and concurrencyTransaction management and concurrency
Transaction management and concurrency
 
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
 
Database Transactions and SQL Server Concurrency
Database Transactions and SQL Server ConcurrencyDatabase Transactions and SQL Server Concurrency
Database Transactions and SQL Server Concurrency
 
TRANSACTION CONCEPTppt.pptx
TRANSACTION CONCEPTppt.pptxTRANSACTION CONCEPTppt.pptx
TRANSACTION CONCEPTppt.pptx
 
CH09.ppt
CH09.pptCH09.ppt
CH09.ppt
 
7. transaction mang
7. transaction mang7. transaction mang
7. transaction mang
 
Dbms
DbmsDbms
Dbms
 
transaction ,concurrency , and DDBMS
transaction ,concurrency , and DDBMStransaction ,concurrency , and DDBMS
transaction ,concurrency , and DDBMS
 
Concurrency note.pdf
Concurrency note.pdfConcurrency note.pdf
Concurrency note.pdf
 
Distributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlDistributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency control
 
Tybsc cs dbms2 notes
Tybsc cs dbms2 notesTybsc cs dbms2 notes
Tybsc cs dbms2 notes
 
Intro to tsql unit 12
Intro to tsql   unit 12Intro to tsql   unit 12
Intro to tsql unit 12
 
CONCURRENCY CONTOL notes.pdf
CONCURRENCY CONTOL notes.pdfCONCURRENCY CONTOL notes.pdf
CONCURRENCY CONTOL notes.pdf
 
Transaction
TransactionTransaction
Transaction
 

More from Eddyzulham Mahluzydde

Primitive types
Primitive typesPrimitive types
Primitive types
Eddyzulham Mahluzydde
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
Eddyzulham Mahluzydde
 
Chapter 3 Entity Relationship Model
Chapter 3 Entity Relationship ModelChapter 3 Entity Relationship Model
Chapter 3 Entity Relationship Model
Eddyzulham Mahluzydde
 
Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2
Eddyzulham Mahluzydde
 
Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3
Eddyzulham Mahluzydde
 
Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1
Eddyzulham Mahluzydde
 

More from Eddyzulham Mahluzydde (6)

Primitive types
Primitive typesPrimitive types
Primitive types
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
 
Chapter 3 Entity Relationship Model
Chapter 3 Entity Relationship ModelChapter 3 Entity Relationship Model
Chapter 3 Entity Relationship Model
 
Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2
 
Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3
 
Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1
 

Recently uploaded

Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 

Recently uploaded (20)

Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 

Chapter 5 Database Transaction Management

  • 2. Course Learning Outcome CLO2 : Develop a database using a concurrency control and data recovery technique to manage the database system.
  • 3. Learning Outcome ¨  Describe the properties of database transaction: a. Atomic b. Consistent c. Isolated d. Durable ¨  Perform a transaction of a given database using SQL statements. ¨  Use START TRANSACTION and COMMIT statements. ¨  State the purpose of concurrency control. ¨  Explain the interference problems arise from simultaneous access to database: a. Lost update b. Uncommitted dependency c. Inconsistent retrieval ¨  Describe the tools used by DBMS to prevent the interference problems : locks, Two-Phase Locking (2PL) protocol. ¨  Describe the recovery tools: a. Transaction log b. Checkpoint c. Database back-up
  • 4. What is Transaction ? ¨  A transaction is a unit of work that should be processed reliably without interference from other users and without loss of data due to failures. ¨  Examples of transactions are withdrawing cash at an ATM, making an airline reservation and registering for a course.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. Concurrency Control ¨  The purpose of concurrency control is to prevent two different users (or two different connections by the same user) from trying to update the same data at the same time. Concurrency control can also prevent one user from seeing out-of-date data while another user is updating the same data.
  • 12. Concurrency Control The following examples explain why concurrency control is needed. For both examples, suppose that your checking account contains $1,000. During the day you deposit $300 and spend $200 from that account. At the end of the day your account should have $1,100. ¨  Example 1: No concurrency control At 11:00 AM, bank teller #1 looks up your account and sees that you have $1,000. The teller subtracts the $200 check, but is not able to save the updated account balance ($800) immediately. At 11:01 AM, another teller #2 looks up your account and still sees the $1,000 balance. Teller #2 then adds your $300 deposit and saves your new account balance as $1,300. At 11:09 AM, bank teller #1 returns to the terminal, finishes entering and saving the updated value that is calculated to be $800. That $800 value writes over the $1300. At the end of the day, your account has $800 when it should have had $1,100 ($1000 + 300 - 200). ¨  Example 2: Concurrency control When teller #1 starts working on your account, a lock is placed on the account. When teller #2 tries to read or update your account while teller #1 is updating your account, teller #2 will not be given access and gets an error message. After teller #1 has finished the update, teller #2 can proceed. At the end of the day, your account has $1,100 ($1000 - 200 + 300).
  • 13. Concurrency Control Interference problem arise from simultaneous access to database: ¨  Lost Update ¨  Uncommitted Dependency ¨  Inconsistent Retrieval
  • 14. Lost Update ¨  Successfully completed update is overridden by another user. ¨  Lost updates occur when two or more transactions select the same row and then update the row based on the value originally selected. ¨  Each transaction is unaware of other transactions. The last updates overwrites updates made by the other transactions which results in lost data.
  • 15. Uncommitted Dependency ¨  Occurs when one transaction can see intermediate results of another transaction before it has committed. ¨  Uncommitted dependency occurs when a second transaction selects a row that is being updated by another transaction. ¨  The second transaction is reading data that has not been committed yet and may be changed by the transaction updating the row.
  • 16. Inconsistent Retrieval ¨  Occurs when transaction reads several values but second transaction updates some of them during execution of first.
  • 17. Database Concurrency Control Two-Phase Locking Techniques -The algorithm (a) Locking (Growing) (b) Unlocking (Shrinking). ¨  Locking (Growing) Phase: A transaction applies locks (read or write) on desired data items one at a time. ¨  Unlocking (Shrinking) Phase: A transaction unlocks its locked data items one at a time. Requirement: For a transaction these two phases must be mutually exclusively, that is, during locking phase unlocking phase must not start and during unlocking phase locking phase must not begin.
  • 18. Slide  18-­‐  18   Deadlock ¨  Deadlock prevention ¤  A transaction locks all data items it refers to before it begins execution. ¤  This way of locking prevents deadlock since a transaction never waits for a data item. ¤  The conservative two-phase locking uses this approach.
  • 19. Slide  18-­‐  19   Deadlock ¨  Deadlock detection and resolution ¤  In this approach, deadlocks are allowed to happen. The scheduler maintains a wait-for-graph for detecting cycle. If a cycle exists, then one transaction involved in the cycle is selected (victim) and rolled-back. ¤  A wait-for-graph is created using the lock table. As soon as a transaction is blocked, it is added to the graph. When a chain like: Ti waits for Tj waits for Tk waits for Ti or Tj occurs, then this creates a cycle. One of the transaction o
  • 20. Types of Recovery Tools ¨  Transaction Log ¤  A table that contains a history of database changes. The recovery manager uses the log table to recover from failures. ¨  Checkpoint ¤  The act of writing a checkpoint to log and writing log and database buffer to disk. ¨  Database Backup ¤  A copy of all or part of disk. Is used when the disk containing the database or log is damaged.