0% found this document useful (0 votes)
2 views6 pages

DBMS Transactions and Recovery Notes

The document provides detailed notes on Database Management Systems (DBMS), covering key concepts such as transactions, ACID properties, transaction control processes, serializability, recoverability, recovery from transaction failure, log-based recovery, checkpoints, deadlock handling, distributed databases, concurrency control, and directory systems. It explains the importance of ensuring data consistency and integrity during concurrent transactions and outlines various techniques for managing these processes. Additionally, it discusses the structure and metadata management within DBMS for efficient database operations.

Uploaded by

ninjapool59
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

DBMS Transactions and Recovery Notes

The document provides detailed notes on Database Management Systems (DBMS), covering key concepts such as transactions, ACID properties, transaction control processes, serializability, recoverability, recovery from transaction failure, log-based recovery, checkpoints, deadlock handling, distributed databases, concurrency control, and directory systems. It explains the importance of ensuring data consistency and integrity during concurrent transactions and outlines various techniques for managing these processes. Additionally, it discusses the structure and metadata management within DBMS for efficient database operations.

Uploaded by

ninjapool59
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DBMS Detailed Notes (Easy Language)

1. Transaction

Transaction ek chhota unit hota hai jo database par ek ya ek se adhik operations perform karta hai.

Iska main purpose data ko correct rakhna hota hai jab multiple users access kar rahe hote hain.

Example: Agar ek bank account se paisa nikalna hai, toh do steps honge:

1. Account balance check karna

2. Balance me se paisa ghataana

Yeh dono steps milke ek transaction banate hain. Agar dono complete ho gaye tabhi data update hoga,

warna nahi.

Properties (ACID):

- Atomicity: Ya to saara kaam hoga, ya kuch bhi nahi hoga.

- Consistency: Database transaction ke baad valid state me hi rahega.

- Isolation: Ek transaction doosre ko affect nahi karega.

- Durability: Ek baar data save ho gaya toh wo permanent ho jaata hai.

2. Transaction Control Process

Transaction Control Process database me transactions ke execution ko manage karta hai.

Iska purpose hota hai ki har transaction safely aur correctly complete ho.

Steps:

1. Begin Transaction - Jab transaction start hota hai.

2. Perform operations - Read, Write, Update etc.

3. Check for correctness - Constraints ko check karna.

4. Commit - Agar sab kuch sahi hai toh changes save karo.

5. Rollback - Agar error aayi toh pehle jaisa data wapas le aao.

Ye process ensure karta hai ki system data loss ya inconsistency se bacha rahe.

3. Serializability
DBMS Detailed Notes (Easy Language)

Serializability ka matlab hai ki jab multiple transactions ek sath execute ho rahe ho,

toh unka final result aisa ho jaisa ki wo ek ek karke serial order me chale ho.

Isse concurrency ke bawajood bhi data consistent rehta hai.

Types:

- Conflict Serializability: Agar ek schedule ko swap karke kisi serial order me badla ja sakta hai.

- View Serializability: Agar transactions same data read/write kar rahe hain but result serial jaisa hai.

4. Testing of Serializability

Serializability test karne ke liye hum schedule ke operations ka analysis karte hain.

Conflict Serializability test:

- Hum ek precedence graph banate hain jisme nodes transactions hote hain.

- Arrows un transactions ke beech conflicts ko dikhate hain.

- Agar graph me koi cycle nahi hai to schedule serializable hai.

- Agar cycle hai to schedule non-serializable hai.

Yeh test system ko allow karta hai ki wo correct transaction scheduling decide kare.

5. Serializability of Schedules

Schedule wo order hota hai jisme transactions ke operations execute hote hain.

Schedule tab serializable hota hai jab uska result kisi serial (ek ke baad ek) transaction ke result ke barabar

ho.

Importance:

- Data consistency maintain hoti hai

- Concurrent transactions safe ban jate hain

Example:
DBMS Detailed Notes (Easy Language)

T1: R(A), W(A)

T2: R(B), W(B)

Agar dono parallel chale aur A & B alag data hain to yeh serializable hai.

6. Recoverability

Recoverability ka matlab hota hai ki agar ek transaction dusre par dependent hai,

toh dependent transaction tabhi commit hoga jab pehla transaction commit ho chuka ho.

Yeh system ko crash ke baad wapas correct state me le jaane me help karta hai.

Example:

T1 ne data write kiya aur T2 ne usi data ko read kiya.

Toh jab tak T1 commit nahi karega, T2 bhi commit nahi karega.

7. Types of Recoverability

1. Recoverable Schedule:

- Dependent transaction commit tabhi karta hai jab jis par wo dependent hai wo pehle commit kare.

2. Cascadeless Schedule:

- T2 tabhi data read karega jab T1 commit kar chuka hoga.

- Isse undo propagate nahi hota.

3. Strict Schedule:

- Write ke liye bhi tab tak wait karega jab tak pehle transaction commit ya abort na ho jaye.

- Sabse safe aur reliable schedule hota hai.

8. Recovery from Transaction Failure

Transaction failure kisi bhi wajah se ho sakta hai jaise:

- System crash

- Power failure

- Deadlock
DBMS Detailed Notes (Easy Language)

Recovery process:

1. System logs ka use karke pata lagaya jata hai ki kaunse transaction complete hue the.

2. Jinka COMMIT hua tha unko REDO karte hain.

3. Jinka COMMIT nahi hua tha unko UNDO karte hain.

Objective: Data ko last consistent state me le aana.

9. Log-Based Recovery

Log ek aisa record hota hai jisme har transaction ke operations store kiye jaate hain.

Types:

- Undo log: Old value store karta hai.

- Redo log: New value store karta hai.

Recovery ke samay:

- Commit ke saath: REDO operation use hota hai.

- Fail hone par: UNDO operation use hota hai.

Log ke bina correct recovery possible nahi hoti.

10. Checkpoints

Checkpoint ek system snapshot hota hai jo certain interval pe liya jata hai.

Purpose:

- System recovery ko fast banana.

- Last checkpoint ke baad ke transactions hi logs se read karne padte hain.

Process:

1. System sabhi running transactions ko suspend karta hai.

2. Unka state stable memory me save karta hai.


DBMS Detailed Notes (Easy Language)

3. Uske baad fir normal transaction chalu ho jate hain.

Isse recovery efficient hoti hai.

11. Deadlock and Handling

Deadlock tab hota hai jab do ya adhik transactions ek dusre ke resources ka wait karte hain,

aur koi bhi forward nahi badh pata.

Example:

T1 ne A lock kiya aur B ke liye wait kar raha hai

T2 ne B lock kiya aur A ke liye wait kar raha hai

Deadlock Handling Techniques:

1. Prevention - Rules set karke deadlock hone hi na diya jaye.

2. Avoidance - Banker's Algorithm jaise method se safe path follow karo.

3. Detection & Recovery - Deadlock hone do, phir detect karo aur rollback karo.

12. Distributed Database and Storage

Distributed database me data multiple physical locations me stored hota hai

lekin user ko centralized hi dikhai deta hai.

Features:

- Location transparency

- High availability

- Fault tolerance

Storage techniques:

1. Fragmentation - Data ko tukdo me todna (horizontal/vertical)

2. Replication - Same data multiple locations me store

3. Allocation - Data ko efficient jagah assign karna


DBMS Detailed Notes (Easy Language)

13. Concurrency and Control

Concurrency ka matlab hai ek hi samay me multiple transactions ka execute hona.

Isse performance improve hoti hai lekin data conflict bhi ho sakta hai.

Problems:

- Lost Update

- Dirty Read

- Unrepeatable Read

Concurrency Control Techniques:

1. Locking (Shared & Exclusive)

2. Timestamp Ordering

3. Two Phase Locking (2PL)

Inse data consistent rehta hai even with concurrent transactions.

14. Directory System

Directory System ek aisa part hota hai DBMS ka jo database ke structure, metadata, user rights,

aur storage information ko store karta hai.

Isme kya hota hai:

- Table names, columns, datatypes

- Indexes and constraints

- User access details

- Relationships among tables

Yeh system ko efficiently manage karne aur query optimize karne me madad karta hai.

You might also like