DBMS Concepts

DBMS Tutorial Components of DBMS. Applications of DBMS The difference between file system and DBMS. Types of DBMS DBMS Architecture DBMS Schema Three Schema Architecture. DBMS Languages.

DBMS ER Model

ER model: Entity Relationship Diagram (ERD) Components of ER Model. DBMS Generalization, Specialization and Aggregation.

DBMS Relational Model

Codd’s rule of DBMS Relational DBMS concepts Relational Integrity Constraints DBMS keys Convert ER model into Relational model Difference between DBMS and RDBMS Relational Algebra DBMS Joins

DBMS Normalization

Functional Dependency Inference Rules Multivalued Dependency Normalization in DBMS: 1NF, 2NF, 3NF, BCNF and 4NF

DBMS Transaction

What is Transaction? States of transaction ACID Properties in DBMS Concurrent execution and its problems DBMS schedule DBMS Serializability Conflict Serializability View Serializability Deadlock in DBMS Concurrency control Protocols

Difference

Difference between DFD and ERD

Misc

Advantages of DBMS Disadvantages of DBMS Data Models in DBMS Relational Algebra in DBMS Cardinality in DBMS Entity in DBMS Attributes in DBMS Data Independence in DBMS Primary Key in DBMS Foreign Key in DBMS Candidate Key in DBMS Super Key in DBMS Aggregation in DBMS Hashing in DBMS Generalization in DBMS Specialization in DBMS View in DBMS File Organization in DBMS What Is A Cloud Database What Is A Database Levels Of Locking In DBMS What is RDBMS Fragmentation in Distributed DBMS What is Advanced Database Management System Data Abstraction in DBMS Checkpoint In DBMS B Tree in DBMS BCNF in DBMS Advantages of Threaded Binary Tree in DBMS Advantages of Database Management System in DBMS Enforcing Integrity Constraints in DBMS B-Tree Insertion in DBMS B+ Tree in DBMS Advantages of B-Tree in DBMS Types of Data Abstraction in DBMS Levels of Abstraction in DBMS 3- Tier Architecture in DBMS Anomalies in Database Management System Atomicity in Database Management System Characteristics of DBMS DBMS Examples Difference between Relational and Non-Relational Databases Domain Constraints in DBMS Entity and Entity set in DBMS ER Diagram for Banking System in DBMS ER Diagram for Company Database in DBMS ER Diagram for School Management System in DBMS ER Diagram for Student Management System in DBMS ER Diagram for University Database in DBMS ER Diagram of Company Database in DBMS Er Diagram Symbols and Notations in DBMS How to draw ER-Diagram in DBMS Integrity Constraints in DBMS Red-Black Tree Deletion in DBMS Red-Black Tree Properties in DBMS Red-Black Tree Visualization in DBMS Redundancy in Database Management System Secondary Key in DBMS Structure of DBMS 2-Tier Architecture in DBMS Advantages and Disadvantages of Binary Search Tree Closure of Functional Dependency in DBMS Consistency in Database Management System Durability in Database Management System ER Diagram for Bank Management System in DBMS ER Diagram for College Management System in DBMS ER Diagram for Hotel Management System in DBMS ER Diagram for Online Shopping ER Diagram for Railway Reservation System ER Diagram for Student Management System in DBMS Isolation in DBMS Lossless Join and Dependency Preserving Decomposition in DBMS Non-Key Attributes in DBMS Data Security Requirements in DBMS DBMS functions and Components What is Homogeneous Database? DBMS Functions and Components Advantages and Disadvantages of Distributed Database

Durability in Database Management System

 Durability in a database management system (DBMS) refers to the ability of the system to persistently store data, even in the event of power loss, system crashes, or other unexpected failures. This is typically achieved through transaction logs, which record all changes made to the database, and disk or flash storage, which can retain data even when power is lost. Additionally, DBMSs may use techniques such as replication and backup to ensure data is not lost during a system failure.

 There are several features that a DBMS can use to ensure data durability, which are as following:

  • Transaction logging
  • Checkpointing
  • Replication
  • Backup and Restore
  • Journaling
  • RAID
  • Automatic Crash recovery
  • Online Backup

1. Transaction logging: This feature records all changes made to the database in a log file so they can be replayed in case of a system failure. Transaction logging is a feature which records all changes made to the database in a log file. The log file contains records of all the transactions executed on the database, such as insertions, updates, and deletions. When a transaction is executed, the DBMS first writes the changes made by the transaction to the log file. They are used in database once the changes are written to the log file. This is known as a "write-ahead" log and ensures that the log file always contains a complete and consistent record of the state of the database, even in the event of a system failure. Suppose the system crashes or experiences a power loss before the changes are applied to the database. In that case, the DBMS can use the information in the log file to recover the database and return it to a consistent state. This process is known as "recovery" and can be done automatically by the DBMS or manually by a database administrator. Transaction logging is crucial for data durability in a DBMS, as it allows the system to recover from unexpected failures and return the database to a consistent state. Additionally, it can also be used for auditing and troubleshooting purposes.
2. Checkpointing: This feature basically saves the current state of the data to disk so that the system can recover quickly in the failure event as a feature that periodically saves the current state of the database to disk checkpointing in a Database. This allows the system to recover quickly if a failure occur, as the most recent checkpoint can be used as a starting point for recovery. When a checkpoint is taken, the DBMS writes the current state of the database to disk and updates the checkpoint's location in the log file. This allows the DBMS to quickly locate the most recent checkpoint in the event of a failure and use it to start the recovery process. Checkpointing is usually done at intervals, like every hour or day. The frequency of checkpointing can be configured by a database administrator based on the requirements of the system and the amount of data that is expected to change. Checkpointing is often used with transaction logging, as both features are designed to ensure data durability in a DBMS. While transaction logging is used to record all changes made to the database, checkpointing is used to periodically save the current state of the database to disk, ensuring that the system can recover quickly in the event of a failure.
3. Replication: This feature creates multiple copies of the database, which can be used to recover from a failure of one or more copies. It is process of copying and distributing data from one database to one or more other databases in a database management system (DBMS). This can be done for various reasons, such as to improve performance, increase fault tolerance, or provide access to data in multiple locations. There are different replications, such as master-slave replication, where one database acts as the master and the others are slaves, and peer-to-peer replication, where all databases are equal. The specifics of replication can vary depending on the specific DBMS database being used.

Replication in a database management system (DBMS) is used for a variety of purposes. Some common uses of replication include as:

  • High availability: The system can continue functioning even if one database becomes unavailable by replicating data to multiple databases.
  • Performance: By replicating data to multiple databases and distributing the load among them, the system can improve the performance of database operations.
  •  Disaster recovery: Replication can be used to create a backup of data that can be used to restore the system in the event of a disaster.
  • Data warehousing: By replicating data to multiple databases and using them for different purposes, it's possible to build a data warehouse for reporting and analytics.
  • Distributed systems: Replication can distribute data across multiple locations, making it more accessible to users in different regions.
  • Data Security: Replicating data in multiple locations can improve data security by keeping a backup copy of the data in a separate location. It's worth noting that the specifics of replication can vary depending on the specific DBMS being used, and the system's complexity can vary widely depending on the specific implementation.

4. Backup and restore: This feature allows administrators to create a copy of the entire database management system, which can be used to restore the database in case of a failure. In a database management system (DBMS), restore and backup refers to create a copy of the database and then using that copy to store the database in the item loss or system failure event.

 Backup: A backup is a process to copy of the data from the database that can be used to restore the database items in the event of data loss or system failure. Backups can be done in many ways, such as full backups, half backups, incremental backups, and differential backups. Full backups copy the whole database, incremental backups copy only the changes since the last backup, and differential backups copy the only changes since the last full backup.

 Restore: Restore uses a backup copy to recover the data in the event of data loss or system failure. When restoring a database, it's necessary to ensure that the backup copy is consistent, meaning that all the data is in a consistent state.

The uses of these are as follows:

  • Data Recovery: Backup and restore can be used to recover database that has been lost due to a hardware failure, software bug, or human error.
  • Data Security: By creating backups, it's possible to protect data from being lost or stolen.
  • Compliance: Some industries have regulations that mandate regular backups to ensure that data is not lost.
  • Test and Development: Developers can use backups to test new database versions or develop new features.
  • Business Continuity: In case of any disasters, Businesses can use the backups for continuity and minimal downtime. It's worth noting that the specifics of backup and restore can vary depending on the specific DBMS being used, and the system's complexity can vary widely depending on the specific implementation and the scale of the database.

5. Journaling: This feature records the changes made to the database on a separate disk to recover the database even if the primary disk fails. In a database management system (DBMS), Journaling is a technique used to ensure data durability, which means that data is permanently stored and can survive system failures. Journaling works by keeping records of all changes made to the database called a journal or log. This journal contains information about the changes made, such as the type of change (e.g., insert, update, delete) and the affected data. If occurs a system failure, the DBMS can use the journal to restore the data to a consistent state. For example, suppose a power failure occurs while a transaction is in progress. In that case, the journal can be used to undo, redo any changes made by that transaction, ensuring that the data remains in a consistent state pf database. Journaling also enables DBMS to support features such as point-in-time recovery, which allows restoring the database to a specific point in time, and replication, which allows creating a copy of the database on another server.

In summary, Journaling is a technique used to ensure data durability and recoverability in DBMS by keeping a record of all the changes made to the database.

6. RAID: Redundant Array of Independent Disks (RAID) provides disk-level data protection by spreading data across multiple disks; this way, if a disk fails, the data can be recovered from the other disks. RAID (Redundant Array of Independent Disks) is a technology which improves database durability in a DBMS by using multiple disks to storing data. RAID can provide data redundancy, meaning multiple copies of the data are stored on different disks. This can protect the data from disk failures and improve the database's performance by spreading the load across multiple disks.

There are so different RAID levels, each with different levels of data redundancy and performance. Some of RAID levels include are as:

  • RAID 0: Level uses striping, which means data is split across multiple disks. This improves the performance but does not provide any data redundancy.
  • RAID 1: This level meaning data is stored on two or more disks uses mirroring. If one disk fails, the database can be read from the other disks, providing redundancy.
  •  RAID 5: This level uses striping and parity, which means that database is split across multiple disks, and multiple disks are used to store parity information. This can provide data redundancy in the way of a single disk failure.
  • RAID 6: This level is similar to RAID 5 but uses dual parity, which means it can survive the failure of two disks.

 In summary, RAID (Redundant Array of Independent Disks) is a technology that improves data durability in a DBMS by using multiple disks to store data, providing data redundancy and improving performance. Different RAID levels provide various levels of data redundancy and performance.

7. Automatic crash recovery: This feature allows the Database Management System (DBMS) to automatically recover from a crash and return to a consistent state. Automatic crash recovery in a database management system (DBMS) is the process by which the DBMS automatically restores the database to a consistent state after a crash or failure. This is typically achieved through transaction logs, which record all changes made to the database, and can be used to undo any incomplete or inconsistent changes made before the crash. The DBMS will also check the integrity of the database and roll back any transaction that was not completed. This is a critical feature to ensure data consistency and durability in a Database Management System.

8. Online Backup: This feature allows the Database Management System (DBMS) to take backup while the system is running, which can be used to recover in an emergency quickly. Online backup in a DBMS refers to the process of creating a backup of a database while it is still in use. This means that users can continue to access and make changes to the database while the backup is being created. This is in contrast to an offline backup, created when the database is not in use, and all users are locked out. Online backups can ensure data durability by providing a way to recover from a failure quickly. For example, if a hardware failure occurs, the DBMS can use the online backup to quickly restore the database to a functional state. Additionally, online backups can be used to restore a database to a specific point in time, which can be useful in cases where data is accidentally deleted or modified.

Advantages of durability in Database Management System

There are several advantages to ensuring data durability in a Database Management System (DBMS) are as below:

  1. Data Protection: Durability ensures that data is protected against hardware failures, software bugs, and other errors. This means that even if something goes wrong, the database will still be available and can be recovered.
  2. Business continuity: With data durability, businesses can continue to operate even in the event of failure. This means that users can continue accessing the data they need, and the business can continue generating revenue.
  3. Compliance: Many industries have regulations that require database to be protected and available at all times. Durability helps organizations to meet these compliance requirements.
  4. Recoverability: Durability ensures that data can be recovered in the event of failure of machines. This means that if something goes wrong, the data can be restored to a previous state, which can help to minimize data loss.
  5. Disaster recovery: Durability is important for disaster recovery as it ensures that data can be recovered after a disaster, such as a fire or a flood. This means that the business can continue to operate even after a disaster time.
  6. Cost savings: Implementing durability mechanisms in a DBMS can help to save costs in the long run as it reduces the need for manual recovery and minimizes data loss, which can result in lost revenue, decreased productivity, and increased costs.