SYSTEMS IMPLEMENTATION TECHNIQUES TRANSACTION PROCESSING DATABASE RECOVERY DATABASE SECURITY CONCURRENCY CONTROL.

Slides:



Advertisements
Similar presentations
1 Term 2, 2004, Lecture 6, TransactionsMarian Ursu, Department of Computing, Goldsmiths College Transactions 3.
Advertisements

Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 16.
TRANSACTION PROCESSING SYSTEM ROHIT KHOKHER. TRANSACTION RECOVERY TRANSACTION RECOVERY TRANSACTION STATES SERIALIZABILITY CONFLICT SERIALIZABILITY VIEW.
CSC271 Database Systems Lecture # 32.
Lock-Based Concurrency Control
Database Administration and Security Transparencies 1.
Lecture 11 Recoverability. 2 Serializability identifies schedules that maintain database consistency, assuming no transaction fails. Could also examine.
CMPT Dr. Alexandra Fedorova Lecture X: Transactions.
Transaction Management and Concurrency Control
Concurrency Control. R/RR/W W/W User 2 ReadWrite User 1 Read Write R/W: Inconsistent Read problem. W/W: Lost Update problem.
10 1 Chapter 10 Transaction Management and Concurrency Control Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Transaction Management and Concurrency Control
Transaction Management and Concurrency Control
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
Chapter 17: Transaction Management
What is a Transaction? Logical unit of work
Transaction Management
1 Transaction Management Database recovery Concurrency control.
DBMS Functions Data, Storage, Retrieval, and Update
Chapter 9 Transaction Management and Concurrency Control
Chapter 8 Security Transparencies © Pearson Education Limited 1995, 2005.
9 Chapter 9 Transaction Management and Concurrency Control Hachim Haddouti.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
Transaction Management and Concurrency Control
Transactions and Recovery
Transaction Management Chapter 9. What is a Transaction? A logical unit of work on a database A logical unit of work on a database An entire program An.
Academic Year 2014 Spring. MODULE CC3005NI: Advanced Database Systems “DATABASE RECOVERY” (PART – 1) Academic Year 2014 Spring.
DATABASE SECURITY By Oscar Suciadi CS 157B Prof. Sin-Min Lee.
Chapter 19 Security Transparencies. 2 Chapter 19 - Objectives Scope of database security. Why database security is a serious concern for an organization.
© Pearson Education Limited, Chapter 5 Database Administration and Security Transparencies.
© 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 CHAPTER 11: DATA AND DATABASE ADMINISTRATION Modern Database Management 11 th Edition Jeffrey.
DBSQL 7-1 Copyright © Genetic Computer School 2009 Chapter 7 Transaction Management, Database Security and Recovery.
1 Transactions BUAD/American University Transactions.
Security and Transaction Nhi Tran CS 157B - Dr. Lee Fall, 2003.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 10 Transaction Management.
Databases Illuminated
ITEC 3220M Using and Designing Database Systems Instructor: Prof. Z. Yang Course Website: 3220m.htm
Chapter 15 Recovery. Topics in this Chapter Transactions Transaction Recovery System Recovery Media Recovery Two-Phase Commit SQL Facilities.
Lecture 12 Recoverability and failure. 2 Optimistic Techniques Based on assumption that conflict is rare and more efficient to let transactions proceed.
1 Chapter 20 Transaction Management Transparencies Last Updated: 17 th March 2011 By M. Arief
11/7/2012ISC329 Isabelle Bichindaritz1 Transaction Management & Concurrency Control.
Introduction to Database Systems1. 2 Basic Definitions Mini-world Some part of the real world about which data is stored in a database. Data Known facts.
Chapter 15 Recovery. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.15-2 Topics in this Chapter Transactions Transaction Recovery System.
CSCI 3140 Module 6 – Database Security Theodore Chiasson Dalhousie University.
The Relational Model1 Transaction Processing Units of Work.
Chapter 20 Transaction Management Thomas Connolly, Carolyn Begg, Database System, A Practical Approach to Design Implementation and Management, 4 th Edition,
CSC 240 (Blum)1 Database Transactions. CSC 240 (Blum)2 Transaction  A transaction is an interaction between a user (or application) and a database. A.
Section 06 (a)RDBMS (a) Supplement RDBMS Issues 2 HSQ - DATABASES & SQL And Franchise Colleges By MANSHA NAWAZ.
Transaction Management Transparencies. ©Pearson Education 2009 Chapter 14 - Objectives Function and importance of transactions. Properties of transactions.
Transaction Management and Concurrent Control
9 1 Chapter 9_B Concurrency Control Database Systems: Design, Implementation, and Management, Rob and Coronel.
10 1 Chapter 10_B Concurrency Control Database Systems: Design, Implementation, and Management, Rob and Coronel.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
10 Transaction Management and Concurrency Control MIS 304 Winter 2005.
©Bob Godfrey, 2002, 2005 Lecture 17: Transaction Integrity and Concurrency BSA206 Database Management Systems.
3 Database Systems: Design, Implementation, and Management CHAPTER 9 Transaction Management and Concurrency Control.
18 September 2008CIS 340 # 1 Last Covered (almost)(almost) Variety of middleware mechanisms Gain? Enable n-tier architectures while not necessarily using.
Chapter 13 Managing Transactions and Concurrency Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
9 1 Chapter 9 Transaction Management and Concurrency Control Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Copyright © 2016 Pearson Education, Inc. CHAPTER 12: DATA AND DATABASE ADMINISTRATION Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman,
Transaction Management and Concurrency Control
By Oscar Suciadi CS 157B Prof. Sin-Min Lee
Transaction Management Transparencies
By Oscar Suciadi CS 157B Prof. Sin-Min Lee
Transaction Properties
Chapter 10 Transaction Management and Concurrency Control
Database Security Transactions
Introduction of Week 13 Return assignment 11-1 and 3-1-5
By Oscar Suciadi CS 157B Prof. Sin-Min Lee
STRUCTURE OF PRESENTATION :
Presentation transcript:

SYSTEMS IMPLEMENTATION TECHNIQUES TRANSACTION PROCESSING DATABASE RECOVERY DATABASE SECURITY CONCURRENCY CONTROL

TRANSACTION PROCESSING Def: A Transaction is a program unit ( deletion, creation, updating etc) whose execution preserves the consistency of a database.

TRANSACTION PROCESSING To ensure that the above is met a transaction must be Atomic Execute to completion Not execute at all

PROPERTIES OF A TRANSACTION 4 Basic properties Also known as the ACID properties Atomicity Consistency Isolation Durability

PROPERTIES OF A TRANSACTION atomicity Also known as the all nothing property A transaction is an individual unit that is either performed in its entirety or not performed at all.

PROPERTIES OF A TRANSACTION Consistency The transaction must transform the database from one consistency state to another consistency state

PROPERTIES OF A TRANSACTION Isolation Transactions execute independently of one another. Durability The effects of a successfully completed transaction are permanently recorded in the database and must never be lost due to subsequent failure

Transactions Management Scenario: transferring money from one account to another in one bank requires the SQL commands:

Transactions Management Transferring £100 from account 1234 to Account Together they comprise a single transaction. Potential problem: Database crash !!

Transaction integrity Crash may leave the Database in inconsistent state in the example, it would be better if neither of the commands had been executed. Transaction integrity demands that the effects of a transaction should be either complete or not enacted at all.

Commit/Rollback protocol exist to support transaction integrity Commit is when changes to a Database are made permanent when a Database crashes, any changes that have not been committed will be lost

Commit We can issue an explicit commit command when both of these update commands have been issued

Rollback a mechanism to undo the effects of a transaction. when issued all of the Database changes since last commit are undone.

Rollback the Rollback in 4 undoes the effect of the Update in 2 because the Update has not been committed – Suppose we issue a Commit command

Commit/Rollback The Commit command in 3 makes the change permanent

DATABASE RECOVERY Def: This is the process of restoring the database to a consistency state after a failure.

DATABASE RECOVERY Types of failure System failure – system entering an undesirable state, like an infinite loop or deadlock. Logic Errors – Bad programmes Hardware failures

Recovery Facilities The DBMS provides the following facilities to recover from failure. Backup Mechanism -: Periodical backup of the system Logging Facility -:Keeps truck of the current state of the transaction and the database

Recovery Facilities Checkpoint Facility -:enables update to the database to be made permanent Recovery manager -:Allows the system t o restore the database to a consistency state following a failure

Recovery Techniques Deferred updates : This were you use a log to record all new transactions and the log will be used to update the database at a later stage.

Recovery Techniques Immediate updates : This is where updates are made to the records immediately and the update is kept in both the log and the database

Recovery Techniques Shadow Paging Two page tables are maintained during the life of a transaction The current page and the shadow page When the transaction starts the two tables are the same

Recovery Techniques The shadow page is not changed and is used to restore the database in the event of a failure The current page is used to record all updates to the database When the transaction completes the current page becomes the shadow page and the shadow page is garbage collected.

DATABASE SECURITY DEF: Mechanism that protects the database against intentional or accidental threats. It encompasses hardware, software, people and data

DATABASE SECURITY It is considered in relation to the following situations: Theft Loss of Confidentiality Loss of privacy Loss of Integrity Loss of Availability

THEFT/FRAUD This the acquisition of data illegally

Confidentiality Refers to the need to maintain secrecy over the data usually that which is critical to an organization

Privacy Refers to the need to protect data about individuals, loss would lead to legal action taken against the organization

Integrity Loss results in invalid and corrupted data

Availability Data must be available to authorized persons at an appropriate time ( when as required) Loss leads to the inability to access data.

Database Security Measures that can be used to safeguard databases from anticipated threats Authorization Authentication Views or subschema encryption

Authentication Mechanisms that determines whether a user is s/he what s/he claims to be Establishing proof of identity Physical traits Pin codes Cards etc

Authorization Also known as Access control This is the granting of rights and privileges that enables a user to have access to the system

Views or subschema A view is a virtual table that does not exist in the database but is produced upon request by particular user

Encryption This is the encoding of the data by a special algorithm that renders the data unreadable by any program without the decryption key.

CONCURRENCY CONTROL Concurrency The process describing two or more users accessing the database at the same time and transactions are interleaved. Undesirable results may occur, hence the need for concurrency control

Concurrency problems The Lost Update Problem The following situation might arise: 1) TA reads Account record Value of balance is ) TB reads Account record Value of balance is ) TA increases to 250 ( ).

The Lost Update Problem 4) TB increases to 350 ( ). 5) TA writes back balance of ) TB writes back balance of 350. The account should have a balance of 450, not 350. The update performed by TA has been lost

The uncommitted dependency When does it occur? Another transaction may start using data that has not yet been committed. – Effects: the 2nd transaction will use false information.

The uncommitted dependency – Example TA Update Accounts Set Balance = Balance Where Accno = 1234; If Balance < 0.00 Then Rollback Else Commit; TB Delete from Accounts Where Balance < 0.00;

The uncommitted dependency Example 1) TA retrieves Account Value of balance is 50. 2) TA reduces balance by 100. Leaving it as ) TA writes back value of - 50.

uncommitted dependency 4) TB retrieves Account Balance is ) TB deletes Account 1234 as it has negative balance. 6) TA rolls back update. Too late! the account has been deleted TB used uncommitted data.

Inconsistent Analysis A transaction accesses records while are they being updated by another transaction. Example 2nd transaction transfers money from one account to another. Hence, should have no effect on TA result.

Inconsistent Analysis TA Select Sum (Balance) From Account; TB Update Accounts Set Balance = Balance Where Accno = 3; Update Accounts Set Balance = Balance Where Accno = 1;

Inconsistent Analysis 2nd transaction transfers money from one account to another. Hence, should have no effect on TA result.

Locking How to avoid all previous problems? Lock the object to prevent access by other transactions A transaction releases the object when it finishes with it Other transactions need to queue until the object is released The lock could be shared or exclusive

Shared Locks A Shared lock S is placed on an object that is being accessed for read only purposes many S locks may be placed an X lock must wait

Exclusive Locks An exclusive lock X, when an object is being altered No other lock may be placed All transactions must wait

The Locking Protocol Relate this to SQL: Many ‘read-only’ operations (e.g. Select) One ‘update’ operation (e.g. Delete)

The Locking Protocol The Lost Update Problem: TA will place an X lock on Account 1234 before it starts update

The Locking Protocol The uncommitted dependency: TA will lock TB out from Account 1234 until it has completed the rollback

The Locking Protocol The inconsistent analysis: TA will place an S lock on all of the account records.

Problems with Locking Appropriate locking can guarantee correctness, However, it also introduces potential undesirable effects: Deadlock No transactions can proceed; each waiting on lock held by another.

Starvation One transaction is permanently "frozen out" of access to data. reduced performance Locking introduces delays while waiting for locks to be released.

Two-Phase Locking A transaction follows a 2 phase locking protocol if all operations precede the first unlock operations in the transaction. According to this protocol every transaction can be divided into two phases

Two-Phase Locking Growing phase A transaction acquires all the locks needed but can not release any locks Shrinking Phase A transaction releases its locks but cannot acquire any locks