Transaction management in DBMS

2,142 views 11 slides Aug 06, 2021
Slide 1
Slide 1 of 11
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11

About This Presentation

Transaction management in DBMS


Slide Content

TRANSACTION MANAGEMENT ACID Properties DBMS In Hindi

Transaction Concept A transaction is a collection of operations that form a single logical unit of work. A transaction include insertion, deletion, modification, or retrieval, commit (to save the data permanently in the data base), rollback (to undo the work done) operations to access the data from the database. The transaction can access database using following operations: READ(D) - It transfer the data item D from database to local memory of that transaction. WRITE(D) – It transfer the data item D from local memory of transaction to the database.

ACID Properties As integrity is an integral part of database, to ensure integrity of database accessed or updated by transaction, the database system maintain the following properties of the transactions i.e. ACID properties. A i.e. Atomicity C i.e. Consistency I i.e. Isolation D i. e. Durability

A tomicity We have two accounts A and B , each containing Rs. 1000 We now start a transaction to deposit Rs. 100 from account A to Account B. T1: READ (A) A = A – 100 WRITE (A) READ (B) B = B + 100; WRITE (B) If transaction T1 fails after WRITE (A), then A is with Rs. 900 and B has Rs. 1000, which does not satisfy consistency criteria so Transaction Management Component will roll back whole transaction and will preserve database to original state as A with Rs.1000 and B with Rs. 1000. Atomicity is responsibility of Transaction Management

C onsistency We have two accounts A and B , each containing Rs. 1000 We now start a transaction to deposit Rs. 100 from account A to Account B. T1: READ (A) A = A – 100 WRITE (A) READ (B) B = B + 100; WRITE (B) Consistency criteria is to have sum of A and B i.e. A+B should remain unchanged after execution of transaction. It refers to the correctness of a database. The total amount before and after the transaction must be maintained. Total before transaction occurs = 1000+1000= 2000 Total after transaction occurs = 900+1100= 2000 Consistency is responsibility of Application Programmer .

Isolation Let A=1000 and B=1000 Consider two transactions T1 and T2. T1: READ (A) T2: READ (A) A = A+100 READ (B) WRITE (A) C: = A + B READ (B) WRITE (C) B = B - 50; WRITE (B) Suppose T1 has been executed till Read (B) and then T2  starts. As a result , interleaving of operations takes place due to which T2  reads correct value of  A but incorrect value of  B  and sum computed by  T2 : (A+ B = 1100+1000=2100)  is thus not consistent with the sum at end of transaction:  T1: (A+ B = 1100 + 950 = 2050).  This results in database inconsistency, due to a loss of 50 units. Hence, transactions must take place in isolation and changes should be visible only after they have been made to the main memory.  The Concurrency Control Component of database system ensures Isolation

Durability This property ensures that once the transaction has completed execution, the updates and modifications to the database are stored in and written to disk and they persist even if a system failure occurs. These updates now become permanent and are stored in non-volatile memory. The effects of the transaction, thus, are never lost.  Durability is responsibility of Recovery Management Component.

Transaction States in DBMS A transaction can be in one of the following states while execution: Active P artially committed Failed Committed Aborted Terminated Read/Write Operations Failure Failure Permanent store Roll Back

Thanks for watching!

If you have a question, you can reach me via e-mail at [email protected] Social Media Handles: omega.teched megha_with megha-sharma24 OMega TechEd