DBMS Unit IV.docx
DBMS Unit IV.docx
DBMS Unit IV.docx
Recovery from deadlock usually involves aborting one or more transactions to break the cycle:
● Transaction Rollback: Choose a victim transaction to rollback to release resources and
break the deadlock.
● Transaction Termination: Permanently abort one or more transactions to resolve the
deadlock.
5. Example Scenario
Consider two transactions, T1 and T2:
1. T1 locks Resource R1.
2. T2 locks Resource R2.
3. T1 requests Resource R2 (currently held by T2) and waits.
4. T2 requests Resource R1 (currently held by T1) and waits.
This situation results in a deadlock, as both transactions are waiting for each other to release
resources.
Techniques of Backup
Backup techniques in a Database Management System (DBMS) are essential for ensuring data
availability and integrity in case of data loss, corruption, or system failure. Here are the primary
techniques for database backups:
1. Full Backup
A full backup involves copying the entire database, including all data, schemas, and objects, at a
specific point in time. Full backup assumes that each time you execute the task, the entire set of
data is copied to the chosen place. Full backup takes much space, time and PC resources, and
often makes many redundant data copies, as most data in the dataset bear no changes between
backups.
Advantages:
o Complete snapshot of the database.
o Simplifies restoration, as only one backup file is needed.
● Disadvantages:
o Time-consuming and resource-intensive.
o Requires significant storage space.
e.g. when you create a complete disk image backup, full backup is the only effective option.
2. Incremental Backup
An incremental backup only copies data that has changed since the last backup (either full or
incremental). Incremental backup processes only files that appeared or changed since the
previous incremental backup. After a first full backup, any next backup will be incremental,
saving only a difference between current dataset and a previous incremental copy
Advantages:
o Faster and requires less storage compared to full backups.
o Efficient use of resources.
● Disadvantages:
o Restoration is more complex, as multiple backup files are needed.
o Recovery time can be longer due to the need to restore from multiple backup sets.
Example: If you initiated a task to backup My Documents folder and conducted an incremental
backup right after completing a full backup, the task wouldn't copy any files. However, if you
modify some files and then run an incremental backup, the task will copy only these modified
files in your dataset.
3. Differential Backup
A differential backup captures all changes made since the last full backup. It does not reference
incremental backups. Differential backup is very much like incremental backup but utilizes
different types of data backup strategies. After a first full backup, any next backup will be
incremental, saving only a difference between current dataset and a previous incremental copy.
Advantages:
Faster backup process compared to full backups.
o
Quicker restoration compared to incremental backups, as only the last full backup
o
and the last differential backup are needed.
● Disadvantages:
o Requires more storage than incremental backups.
o Differential backup files grow larger over time until the next full backup is taken.
Example: Make a database backup task with differential backup. Let us assume that there are
100 tables in a database, and one table will change per minute. After 10 minutes of task
execution we will have a full copy of an entire database and a differential copy containing only
those 10 tables that was changed.
4. Mirror Backup
Mirror backups create an exact copy (mirror image) of the database, often in real-time or near
real-time.
● Advantages:
o Provides up-to-date copies of the database.
o Enables rapid failover in case of primary database failure.
● Disadvantages:
o Requires significant storage and network resources.
o Does not protect against logical errors (e.g., accidental deletion), as changes are
mirrored immediately.
5. Continuous Data Protection (CDP)
CDP, also known as real-time backup, continuously captures and records changes to data,
allowing the database to be restored to any point in time.
● Advantages:
o Allows for precise point-in-time recovery.
o Minimizes data loss in case of failure.
● Disadvantages:
o Requires substantial storage and computational resources.
o Can be complex to manage and configure.
6. Logical Backup
Logical backups involve exporting database objects, such as tables and procedures, into a format
like SQL scripts.
● Advantages:
o Portability: Logical backups can be easily moved and restored on different
systems.
o Flexibility in restoring specific objects.
● Disadvantages:
o Time-consuming for large databases.
o May not capture all database settings and configurations.
7. Physical Backup
Physical backups involve copying the physical files used by the database (data files, log files,
control files).
● Advantages:
o Typically faster than logical backups for large databases.
o Comprehensive, as it includes all database structures.
● Disadvantages:
o Less flexible: Physical backups are specific to the database system and version.
o Larger storage requirement compared to logical backups.
8. Snapshot Backup
Snapshot backups create a read-only copy of the database at a specific point in time, usually
using storage-level snapshot technology.
● Advantages:
o Very fast backup process.
o Minimal impact on database performance.
● Disadvantages:
o Dependent on underlying storage infrastructure.
o Typically not suitable for long-term retention.
9. Cloud Backup
Cloud backups involve storing database backups in cloud storage services, offering offsite
storage and redundancy.
● Advantages:
o Scalability and flexibility.
o Offsite protection against local disasters.
● Disadvantages:
o Requires reliable network connectivity.
o Potentially higher costs over time.
10. Tape Backup
Tape backups use magnetic tape as the storage medium, often used for archival and long-term
storage.
● Advantages:
o Cost-effective for long-term storage.
o High capacity and reliability.
● Disadvantages:
o Slower access and retrieval times.
o Requires specific hardware and handling.
Database Security Techniques
Ensuring the security and proper storage of databases is critical to protecting sensitive
information and maintaining data integrity. Here are various database security and storage
techniques:
Database Security Techniques
1. Access Control
o Role-Based Access Control (RBAC): Assign permissions to roles rather than
individuals, simplifying the management of user permissions.
o Mandatory Access Control (MAC): Restricts access based on information
sensitivity and user clearance levels.
o Discretionary Access Control (DAC): Allows data owners to decide who can
access their data.
2. Authentication and Authorization
o Multi-Factor Authentication (MFA): Requires users to provide two or more
verification factors to access the database.
o Strong Password Policies: Enforces complexity requirements and regular
password changes.
o OAuth and OpenID: Use these protocols for secure API authentication and
authorization.
3. Encryption
o Data-at-Rest Encryption: Encrypts data stored on disks using technologies like
AES (Advanced Encryption Standard).
o Data-in-Transit Encryption: Secures data during transmission using protocols
like TLS (Transport Layer Security).
o Column-Level Encryption: Encrypts specific columns within a database,
particularly useful for sensitive fields.
4. Database Auditing and Monitoring
o Audit Logs: Track database access and modifications to detect unauthorized
activities.
o Intrusion Detection Systems (IDS): Monitor database activity for suspicious
behavior.
o Anomaly Detection: Use machine learning to identify unusual patterns that may
indicate a security threat.
5. Data Masking
o Static Data Masking: Permanently hides sensitive data in non-production
environments.
o Dynamic Data Masking: Hides data in real-time based on user roles and
permissions.
6. Backup and Recovery
o Regular Backups: Implement automated, regular backups to prevent data loss.
o Disaster Recovery Planning: Develop and test disaster recovery plans to ensure
data availability.
7. Vulnerability Management
o Patch Management: Regularly apply security patches to database software to
protect against known vulnerabilities.
o Database Hardening: Disable unnecessary services and remove default accounts
to reduce the attack surface.
8. Network Security
o Firewalls: Use network and database firewalls to restrict access to trusted IP
addresses.
o Virtual Private Networks (VPNs): Securely connect to databases over public
networks.
Database Storage Techniques
What is storage? Why we need storage?
Storage is the collection of methods and technologies that can capture and hold digital
information on media. Storage is normally described as the data storage devices that are
connected to the computer through input or output operations that includes flash devices, hard
disks, SAN, NAS, old tape systems and other different types of medium.
Storage Types
There are a lot of options that are available for storing data. The main purpose is deciding which
is the most appropriate for you. All are different on the basis of their need and usage criteria e.g.
CD, Punch card, Zip disk, DVD, Blu-ray disc, Flash jump drive, Hard Drive, Floppy diskette,
NAS, Tape drive, SSD (Solid State Drive), NAS and Cloud Storage. For example, we are using
USB Flash drives for our students data management here at Network Walks Academy.