DBMS
DBMS Part-1
- DBMS Introduction
- DBMS Architecture
- Database Approach vs Traditional File System
- Advantages of DBMS
- Data Models in DBMS
- Schemas in DBMS
- Instances in DBMS
- Data Independence in DBMS
- Database Languages in DBMS
- Interfaces in DBMS
- Structure of DBMS
- Functions of DBA and Designer
- Entities and Attributes in DBMS
- ER Diagram in DBMS
- Generalization, Specialization and Aggregation in DBMS
- Converting ER Diagram to Tables in DBMS
- Difference between Object Oriented, Network and Relational Data Models
DBMS Part-2
- Relational Data Model in DBMS
- Keys in DBMS
- SQL Introduction
- DDL(Data Definition Language)
- DML(Data Manipulation Language)
- Integrity Constraints in DBMS
- Complex SQL Queries
- Joins in DBMS
- Indexing in DBMS
- Triggers in DBMS
- Assertions in DBMS
- Relational Algebra in DBMS
- Tuple Relational Calculus in DBMS
- Domain Relational Calculus in DBMS
DBMS Part-3
- Introduction to Normalization in DBMS
- Normal Forms in DBMS
- Functional Dependency in DBMS
- Decomposition in DBMS
- Dependency Preserving Decomposition in DBMS
- Lossless Join Decomposition in DBMS
- Problems with Null Values and Dangling Tuples
- Multivalued Dependency in DBMS
- Query Optimization in DBMS
- Algorithms for Select, Project and Join Operations in DBMS
- Query Optimization Methods in DBMS
DBMS Part-4
- Transactions in DBMS
- Serializability in DBMS
- Recoverability in DBMS
- Recovery Techniques in DBMS
- Log Based Recovery in DBMS
- Checkpoint in DBMS
- Deadlock in DBMS
- Concurrency Control in DBMS
- Lock Based Protocol in DBMS
- Timestamp Based Protocol in DBMS
- Validation Based Protocol in DBMS
- Multiple Granularity in DBMS
- Multi-Version Concurrency Control(MVCC) in DBMS
- Recovery with Concurrent Transactions in DBMS
DBMS Part-5
Recovery Techniques in DBMS
Recovery ka matlab kya hota hai?
Kabhi-kabhi computer ya database crash ho jaata hai (jaise bijli chali gayi, software crash ho gaya, system bandh ho gaya, etc.). Aise time pe kuch data lost ya corrupt ho sakta hai.
Recovery ka kaam hota hai database ko wapis theek aur sahi condition mein lana — jaise ki crash se pehle tha.
Types of Failures in DBMS
Failure Type | Kya Hota Hai |
---|---|
Transaction Failure | Jab ek transaction khud hi fail ho jaata hai (jaise galat query) |
System Crash | Pura DB ya OS crash ho jaata hai transaction ke beech mein |
Disk Failure | Hard disk kharaab ho gayi, data access nahi ho raha |
Software Error | Software ya code mein bug aa gaya |
Recovery ka Goal kya hai?
-
Atomicity – Transaction ya toh pura chale ya bilkul na chale.
-
Durability – Agar transaction commit ho gaya, toh uska data safe hona chahiye, chahe system crash ho jaye.
Recovery Techniques in DBMS
Chaliye ab samajhte hain wo techniques jo DBMS use karta hai recovery ke liye:
1. Log-Based Recovery
Log kya hota hai?
-
Log ek file hoti hai jisme sabhi changes ka record hota hai.
-
Isko stable memory mein store kiya jaata hai.
-
Crash ke baad, isi se pata chalta hai kya changes undo ya redo karne hain.
Log Example:
<T1, START>
<T1, A, 100, 200>
<T1, COMMIT>
-
T1 transaction ne A ko 100 se 200 banaya, aur successfully commit ho gaya.
Undo vs Redo
Situation | Kya karenge |
---|---|
Commit nahi hua | Undo – changes wapas lo |
Commit ho gaya | Redo – changes firse apply karo |
Diagram – Log-Based Recovery
Crash hone ke baad:
↓
+--------+ +------------+
|Log File| --> |Recovery Mgr|
+--------+ +------------+
↓
Undo / Redo karega
↓
Database theek ho jayega
2. Checkpointing
Checkpoint kya hota hai?
-
Checkpoint ek aisa point hota hai jaha database ka snapshot save kar liya jaata hai(ye bilkul game ke checkpoint jesa hi hota hai example agar aap game me koi level cross kar chuke hai to woh progress save hojati hai aur agar next time aap usi level se start karna chahe to kar sakte hai).
-
Ye Recovery mein time bachane ke liye helpful hai.
Kaise kaam karta hai:
-
Memory ke sabhi changes disk pe likh diye jaate hain.
-
Ek “CHECKPOINT” log mein likh diya jaata hai.
Example:
3. Shadow Paging
Kya hota hai?
-
Yahan 2 page tables hoti hain:
-
Shadow Page Table – original (safe copy)
-
Current Page Table – changes ke liye
-
Jab transaction commit karta hai, toh current table ko shadow se replace kar dete hain.
Pros:
-
Fast, koi undo/redo nahi
Cons:
-
Large data changes mein thoda slow ho sakta hai
4. ARIES – Advanced Recovery
ARIES ka matlab hai – Algorithm for Recovery and Isolation Exploiting Semantics
Ye advanced DBMS jaise IBM DB2, SQL Server mein use hota hai.
3 Steps mein kaam karta hai:
-
Analysis Phase – crash ke baad kya hua, samjho
-
Redo Phase – commit hua data apply karo
-
Undo Phase – uncommit data hatao
Example – Recovery Scenario
<T1 START>
<T1, A = 100 → 200>
<T2 START>
<T2, B = 300 → 400>
<T1 COMMIT>
CRASH
Recovery:
-
T1 → Commit mil gaya → Redo
-
T2 → Commit nahi mila → Undo
Summary Table:
Technique | Log Use | Snapshot | Undo / Redo | Complexity |
---|---|---|---|---|
Log-Based | Yes | No | Yes | Medium |
Checkpointing | Yes | Yes | Yes | Medium |
Shadow Paging | No | Yes | No | Low |
ARIES | Yes | Yes | Yes | High |