Introduction to Database System
Comprehensive exam revision notes for BCA-104N Unit 5 (Database Security, Integrity, Control & Recent Trends). Includes Section A (2M), Section B (5M), and Section C (15M) questions, answers, and diagrams.
Introduction to Database System
Database Security, Integrity, Control & Recent Trends
Core Definitions & Key Concepts
State and explain the ACID Properties of database transactions
- Atomicity: All operations of a transaction succeed completely or none do ('All or Nothing').
- Consistency: Execution of a transaction preserves database integrity invariants.
- Isolation: Concurrent transactions execute without interfering with one another.
- Durability: Once committed, updates persist permanently even in the event of power crash.
What is SQL Injection (SQLi) and how is it prevented
SQLi occurs when malicious SQL code is injected into input form fields to alter database commands. Prevented by using Parameterized Queries (Prepared Statements), input validation, and least privilege accounts.
Role-Based Access Control (RBAC)
RBAC assigns permissions to specific business roles (e.g., accountant, cashier) rather than directly to individual users. Users are assigned roles, simplifying security administration.
Give the syntax and examples of GRANT and REVOKE commands
GRANT SELECT, INSERT ON Employee TO user_ravi;REVOKE INSERT ON Employee FROM user_ravi;
A Deadlock in database concurrency control
A deadlock occurs when two or more transactions are in a simultaneous circular wait state, each holding a lock that the other requires to proceed.
Differentiate Shared Locks (S) from Exclusive Locks (X)
- Shared Lock (S): Allows concurrent transactions to read data, but prevents writes.
- Exclusive Lock (X): Grants exclusive read and write access to a single transaction; all other transactions are locked out.
What is Data Fragmentation in Distributed DBMS? Name its three types
Dividing a database relation into smaller pieces stored across multiple network sites. Types: (1) Horizontal Fragmentation (subsets of rows via selection), (2) Vertical Fragmentation (subsets of columns via projection), (3) Hybrid / Mixed Fragmentation.
What is NoSQL and in what scenarios is it preferred over RDBMS
NoSQL (Not Only SQL) databases provide schema-less storage, horizontal scale-out across clusters, and high-velocity ingestion for unstructured/semi-structured data (Key-Value, Document, Column-Family, Graph databases).
Conceptual & Architectural Analysis
The Two-Phase Locking (2PL) Protocol and its role in ensuring serializability
1. Two-Phase Locking Principle
2PL guarantees serializable transaction schedules by requiring each transaction to acquire and release locks in two separate distinct phases:
- Growing Phase: Transaction may acquire new locks, but cannot release any lock.
- Shrinking Phase: Once the first lock is released, the transaction enters the shrinking phase where it may release remaining locks, but cannot acquire any new lock.
Number of Locks
^ Peak / Lock Point
| /\
| Growing / \ Shrinking
| Phase / \ Phase
| / \
+------------------------> Time- Strict 2PL: Holds all Exclusive locks until
COMMITorROLLBACK, eliminating cascading rollbacks.
Distributed Databases: Compare Synchronous vs Asynchronous Replication and Horizontal vs Vertical Fragmentation
1. Data Fragmentation
- Horizontal Fragmentation: Tuples of table
Rare split into subsets usingWHEREclauses (e.g.,Emp_NorthandEmp_South). Reconstructed viaUNION. - Vertical Fragmentation: Attributes are split into subsets containing the primary key (e.g.,
Emp_PersonalandEmp_Salary). Reconstructed viaNATURAL JOIN.
2. Data Replication
- Synchronous Replication: Master updates all replicas before committing transaction; guarantees strong consistency at the expense of higher write latency.
- Asynchronous Replication: Master commits locally immediately and propagates updates in background; high write throughput with eventual consistency.
In-Depth Analysis & Implementation
Discuss Transaction Processing in DBMS. Explain the Transaction State Diagram, the Write-Ahead Logging (WAL) protocol, and log-based recovery (Undo and Redo operations)
1. Transaction State Diagram
+-----------------+ +----------------+
| Active |--------->| Partially |
+-----------------+ | Committed |
| | +----------------+
| | |
v v v
+-----------+ +-----------+ +----------------+
| Failed |<-| Aborted | | Committed |
+-----------+ +-----------+ +----------------+- Active: Initial state; transaction executes read/write operations.
- Partially Committed: Final statement executed, but updates still reside in memory buffers.
- Committed: Updates flushed safely to disk; transaction completes successfully.
- Failed: Normal execution cannot proceed due to hardware error, logic error, or deadlock.
- Aborted: Transaction rolled back and database restored to prior consistent state.
2. Write-Ahead Logging (WAL) Protocol
WAL dictates that any change to a database block must be written to stable non-volatile log storage on disk before the modified buffer page is written to the database disk file. Every log entry contains: <T_id, Variable, Old_Value, New_Value>.
3. Log-Based Crash Recovery: Undo and Redo
When the system reboots following an abrupt power failure:
- Redo List: Contains transactions whose log has both
STARTandCOMMITrecords. The recovery manager re-appliesNew_Valueto ensure durability. - Undo List: Contains active transactions having
STARTbut noCOMMITrecord. The recovery manager restoresOld_Valuebackwards to guarantee atomicity.
Important Exam Points & Quick Revision
In BCA-104N Unit 5, the ACID properties, transaction state transition diagram, and Two-Phase Locking (2PL) protocol appear regularly for 10–15 marks. Draw the transaction state machine and explain the commit point clearly.
100% left on this page — finishing it closes the gap for Database Security, Integrity, Control & Recent Trends.
Database Security, Integrity, Control & Recent Trends still counts as a weak topic until you finish this note and answer its questions.
Practise this unitTest Your Understanding
Now that you've read through these notes, practice unit MCQs to identify weak points and solidify your learning before exams.