Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction of Week 13 Return assignment 11-1 and 3-1-5

Similar presentations


Presentation on theme: "Introduction of Week 13 Return assignment 11-1 and 3-1-5"— Presentation transcript:

1 Introduction of Week 13 Return assignment 11-1 and 3-1-5
Collect assignment Questions? Review of week 12 DBA activities Oracle DBMS tools Oracle data dictionary Privileges Database Management Systems

2 Module 6 Advanced Database Concepts
Section 2: Transaction Processing Module 6 Advanced Database Concepts

3 DML Action Simple SELECT statement to generate a list of table contents A series of related UPDATE statements to change the values of attributes in various tables A series of INSERT statements to add rows to one or more tables A combination of SELECT, UPDATE, and INSERT statements Database Management Systems

4 Transaction A logical unit of work that must be either entirely completed or aborted Successful transaction changes the database from one consistent state to another, in which all data integrity constraints are satisfied Most real-world database transactions are formed by two or more database DML requests Database Management Systems

5 Transaction Properties
Atomicity - all operations (SQL requests) of a transaction be completed Durability – indicates permanence of database’s consistent state Serializability - ensures that the concurrent execution of several transactions yields consistent results Isolation - Data used during execution of a transaction cannot be used by second transaction until first one is completed Database Management Systems

6 The Transaction Log A record for the beginning of transaction
For each transaction component (SQL statement) Type of operation being performed (update, delete, insert) Names of objects affected by the transaction (the name of the table) “Before” and “after” values for updated fields Pointers to previous and next transaction log entries for the same transaction The ending (COMMIT) of the transaction Database Management Systems

7 A Transaction Log Database Management Systems

8 Database Audit Trail From the backup and logs, databases can be restored in case of damage or loss Database Management Systems

9 Concurrency Control Coordination of simultaneous transaction execution in a multiprocessing database system Objective is to ensure transaction serializability in a multiuser database environment Database Management Systems

10 Concurrency Control Important  simultaneous execution of transactions over a shared database can create several data integrity and consistency problems lost updates uncommitted data inconsistent retrievals Database Management Systems

11 Lost Updates: Normal Execution
Database Management Systems

12 Lost Updates: Concurrency Problem
Database Management Systems

13 Uncommitted Data: Correct Executions
Database Management Systems

14 Uncommitted Data: Concurrency Problem
Database Management Systems

15 Inconsistent Retrievals: Two Transactions
Database Management Systems

16 Inconsistent Retrievals: Correct Transaction Results
Database Management Systems

17 Inconsistent Retrievals: Concurrency Problem
Database Management Systems

18 The Scheduler Special DBMS program: establishes order of operations within which concurrent transactions are executed Interleaves the execution of database operations to ensure serializability and isolation of transactions Database Management Systems

19 The Scheduler (continued)
Bases its actions on concurrency control algorithms Ensures computer’s central processing unit (CPU) is used efficiently Facilitates data isolation to ensure that two transactions do not update the same data element at the same time Database Management Systems

20 Conflicting Database Operations Matrix
Database Management Systems

21 Concurrency Control with Locking Methods
Guarantees exclusive use of a data item to a current transaction Required to prevent another transaction from reading inconsistent data Lock manager Responsible for assigning and policing the locks used by the transactions Database Management Systems

22 Updates with locking for Concurrency Control
This prevents the lost update problem Database Management Systems

23 Lock Granularity Indicates the level of lock use
Locking can take place at the following levels: Database Table Block or page Record (row) Field (attribute) Database Management Systems

24 Lock Types Binary lock Exclusive lock Shared lock
Has only two states: locked (1) or unlocked (0) Exclusive lock Access is specifically reserved for the transaction that locked the object Must be used when the potential for conflict exists Shared lock Concurrent transactions are granted Read access on the basis of a common lock Database Management Systems

25 An Example of a Binary Lock
Database Management Systems

26 Two-Phase Locking to Ensure Serializability
Defines how transactions acquire and relinquish locks Guarantees serializability, but it does not prevent deadlocks Growing phase, in which a transaction acquires all the required locks without unlocking any data Shrinking phase, in which a transaction releases all locks and cannot obtain any new lock Database Management Systems

27 Two-Phase Locking to Ensure Serializability (continued)
Governed by the following rules: Two transactions cannot have conflicting locks No unlock operation can precede a lock operation in the same transaction No data are affected until all locks are obtained—that is, until the transaction is in its locked point Database Management Systems

28 Two-Phase Locking Protocol
Database Management Systems

29 Deadlocks Condition that occurs when two transactions wait for each other to unlock data Possible only if one of the transactions wants to obtain an exclusive lock on a data item No deadlock condition can exist among shared locks Database Management Systems

30 How a Deadlock Condition Is Created
Database Management Systems

31 Deadlocks Control Prevention – a transaction requesting a new lock is aborted if it might cause a deadlock Detection Allow deadlocks to occur Mechanisms for detecting and breaking them, such as resource usage matrix Avoidance – a transaction must obtain all the locks it needs before it can be executed. Database Management Systems

32 Concurrency Control with Time Stamping Methods
Assigns a global unique time stamp to each transaction Produces an explicit order in which transactions are submitted to the DBMS Uniqueness - ensures that no equal time stamp values can exist Monotonicity - ensures that time stamp values always increase Database Management Systems

33 Deadlock Resolution Schemes
Wait/die - older transaction continues and the younger is rolled back Wound/wait - older transaction rolls back the younger transaction continues Database Management Systems

34 Concurrency Control with Optimistic Methods
Based on the assumption that the majority of database operations do not conflict Does not require locking or time stamping techniques Transaction is executed without restrictions until it is committed Phases are read, validation, and write Database Management Systems

35 Database Recovery Management
Restores database from a given state, usually inconsistent, to a previously consistent state Based on the atomic transaction property - all portions of the transaction must be treated as a single logical unit of work If transaction operation cannot be completed, transaction must be aborted, and any changes to the database must be rolled back Database Management Systems

36 Database Backup Level of backup Failures that plague databases
Full backup Differential backup, incremental backup Transaction log backup Failures that plague databases Software – OS, DBMS, applications Hardware – memory errors, disk crashes Human errors Database Management Systems

37 Wrap Up No new assignment! Database Management Systems


Download ppt "Introduction of Week 13 Return assignment 11-1 and 3-1-5"

Similar presentations


Ads by Google