Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Management System

Similar presentations


Presentation on theme: "Database Management System"— Presentation transcript:

1 Database Management System
Lecture - 42 © Virtual University of Pakistan

2 © Virtual University of Pakistan
Transaction Generally reflects the activities in the real world system One transaction in our exam system may be computing gpa of a student, Operations involved….. More complex transactions © Virtual University of Pakistan

3 © Virtual University of Pakistan
Consistent State of DB Consistent state of the database Duplicated data does not conflict DB properly reflect the real-world system, i.e. follows the business rules A transaction should transform database from one consistent state to another consistent state, may be inconsistent temp © Virtual University of Pakistan

4 Transaction Termination
Two ways a transaction terminates or ends It may Commit or Abort If executed successfully, brings the database in a new consistent state, said to be committed © Virtual University of Pakistan

5 Transaction Termination
If otherwise, database has to be brought in prior consistent state Such transaction is rolled back or undone A committed transaction cannot be undone; compensating transaction © Virtual University of Pakistan

6 Transaction Boundaries
Means being and end of Tr Generally responsibility of programmer Otherwise approach varies from DBMS to DBMS © Virtual University of Pakistan

7 © Virtual University of Pakistan
ACID Properties Atomicity: all or none Consistency: maintains consistency of the DB Isolation: Tr should be protected form the effect of other Trs Durability: changes by Tr are permanent © Virtual University of Pakistan

8 © Virtual University of Pakistan
Database Updates Updates are first made in the buffers in RAM, then transferred to database There may be some delay between the two © Virtual University of Pakistan

9 © Virtual University of Pakistan
Database Recovery If a crash occurs during this delay then the database is in in consistent state On restart DBMS has to identify it and recover DB into a consistent state © Virtual University of Pakistan

10 © Virtual University of Pakistan
Reasons of Failure Natural disaster Sabotage Carelessness Disk crash System software errors Generally, improper shut down of DBMS © Virtual University of Pakistan

11 © Virtual University of Pakistan
Recovery Techniques System crashes, buffers are lost but the disk copy is safe Need to determine the transactions that need to redone or undone © Virtual University of Pakistan

12 © Virtual University of Pakistan
Log File Tool used for database recovery Transaction Record <T, starts> <T, commits> or <T, aborts> Data entries? © Virtual University of Pakistan

13 Transaction Operations
Read (X) X = X + 5 Write (X) Y = Y * 3 Write (Y) Commit Operations of DBMS concern Concern of Recovery Manager So log file contains entries only for write operations © Virtual University of Pakistan

14 © Virtual University of Pakistan
Deferred Updates Called incremental log with deferred updates Updates are not performed until commit is encountered Data entries in the log file of the form <T, X, c>; simplified © Virtual University of Pakistan

15 © Virtual University of Pakistan
Log File Entries Read (X) X = X + 5 Write (X) Y = Y * 15 Write (Y) Commit <T, starts> <T, X, 55> <T, Y, 30> <T, commit> Supposing X = 50 Y = 10 © Virtual University of Pakistan

16 Database Management System
Lecture - 42 © Virtual University of Pakistan


Download ppt "Database Management System"

Similar presentations


Ads by Google