In terms of a database, failure is defined as the inability to execute the given transaction or the loss of data. A DBMS is subject to a variety of failures, each of which requires a unique management approach. Database failures can occur for a variety of causes, including network failure, system crashes, natural disasters, carelessness, sabotage (intended data corruption), software flaws, and so on.
Failure Classification in DBMS
A failure in DBMS can be classified as:
1. Transaction Failures
Logical errors: Occur when logical conditions in the transaction are not met, such as division by zero or constraint violations.
System errors: Caused by hardware or software faults that result in transaction abortion. This may include deadlocks or a lack of resources.
2. System Failures
Power failures: A sudden loss of electrical power causes all volatile memory contents to be lost.
Software crashes: Failures caused by bugs or system crashes that prevent the database management system from working properly.
3. Media Failures
Disk failures: Physical damage to storage media, such as hard drives or SSDs, causes data corruption or loss.
Storage
Storage in a Database Management System (DBMS) is critical for data management and retention. It can be divided into two sorts based on volatility and permanence.
1. Volatile Storage
Definition: Temporary storage that loses content when the power is switched off.
Example: Random access memory (RAM).
Use:
Buffers and caches: Holds interim results, current transactions, and frequently accessible data to accelerate operations.
Working Storage: Used to do temporary computations during query processing and execution.
2. Non-Volatile Storage
Definition: Permanent storage that keeps data even when the system is turned off.
Examples:
Hard Disk Drives (HDD): Traditional magnetic storage with moving components.
Solid State Drives (SSD): Using flash memory, you can store data more quickly and without moving parts.
Tape Drives: Used for archival and long-term backup storage.\
Storage Hierarchy in DBMS
1. Primary storage (main memory)
Characteristics: Fast access, limited capacity, and volatile.
Role: Stores data that is currently being processed and accessed by the CPU.
2. Secondary Storage (Disk Storage)
Characteristics: Larger capacity, slower access than main memory, and nonvolatile.
Role: Stores database files, indices, logs, and other permanent data.
3. Tertiary Storage (Archive Storage)
Characteristics: Very large capacity, slower access, and non-volatile.
Role: Used for backups, data archiving, and disaster recovery.
Storage Management Techniques
1. Data files:
Organization: Data is arranged into files, which are then separated into pages or blocks.
Structure: Tables are kept in rows on these pages.
2. Indexing:
Purpose: Creates indexes on one or more columns in a table to improve data retrieval speed.
Types: B-tree, hash, bitmap, etc.
3. Buffer Management:
Buffer Pools: A location in main memory where data pages are temporarily stored.
Buffer Replacement Policy: LRU (Least Recently Used) algorithms determine which pages should be kept in memory.
4. Logging and journaling:
Write Ahead Logging (WAL): Ensures that changes are recorded in a log before being applied to the database, hence facilitating recovery operations.
Transaction logs: Keep track of all transactions and modifications for recovery purposes.
5. Data Compression:
Purpose: Reduces storage space requirements by employing techniques such as row- and column-level compression.
FAQs About Topic
Transaction Failures
System Failures
Media Failures
Volatile storage (such as RAM) loses data when power is turned off, but non-volatile storage (such as HDDs and SSDs) preserves data even when shut off.
Logical errors include constraint violations.
System problems include deadlocks and resource unavailability.