lecture-8
lecture-8
Evrad KAMTCHOUM
1 Introduction
6 Conclusion
What is Backup?
A backup is a copy of data from a database that is taken to ensure
that the data can be restored in case of data loss or corruption.
Types of backups include full, incremental, and differential backups.
What is Recovery?
Recovery is the process of restoring the data from a backup to its
original or a previous state after data loss, corruption, or failure.
Recovery strategies include point-in-time recovery, complete recovery,
and incomplete recovery.
Human Error
Accidental Deletion: Mistakenly deleting important files or records.
Incorrect Data Entry: Entering wrong data that leads to loss or corruption.
Hardware Failures
Disk Crashes: Hard drives can fail, leading to data inaccessibility.
Power Outages: Sudden loss of power can corrupt data or cause hardware
damage.
Software Issues
Bugs and Glitches: Software bugs can corrupt data or cause unexpected
losses.
Compatibility Issues: Conflicts between software versions can result in data
loss.
Evrad KAMTCHOUM (CCMC (UBa)) Database Systems January 16, 2025 6 / 51
Risks of Data Loss (2)
Cyber Threats
Malware and Viruses: Can destroy, corrupt, or steal data.
Ransomware: Locks access to data until a ransom is paid, with no guarantee of data
return.
Natural Disasters
Floods, Earthquakes, Fires: Physical destruction of data storage systems.
Other Catastrophes: Events like hurricanes or tornadoes can damage infrastructure.
Third-Party Tools
Veritas NetBackup
IBM Tivoli Storage Manager
Backup
1 # F u l l Backup
2 mysqldump −u r o o t −p − a l l −d a t a b a s e s > f u l l b a c k u p . s q l
3
4 # I n c r e m e n t a l Backup u s i n g B i n a r y L o g s
5 m y s q l a d m i n f l u s h −l o g s
6 cp / v a r / l o g / m y s q l / mysql−b i n . 0 0 0 0 0 1 / backup /
7
Recovery
1 # R e s t o r e F u l l Backup
2 m y s q l −u r o o t −p < f u l l b a c k u p . s q l
3
4 # A p p l y I n c r e m e n t a l Backup
5 m y s q l b i n l o g / backup / mysql−b i n . 0 0 0 0 0 1 | m y s q l −u r o o t −p
6
Data Protection
Ensure that data is safeguarded against loss, corruption, and unauthorized access.
Provide mechanisms to restore data to its original state in case of any incidents.
Business Continuity
Minimize downtime and maintain continuous business operations.
Quickly restore critical systems and applications to operational status.
Disaster Recovery
Develop a plan to recover from major incidents such as natural disasters or cyber-attacks.
Ensure that data can be restored to a secondary location if the primary site is
compromised.
Cost Efficiency
Optimize the cost of backup storage and recovery processes.
Balance the cost of backup solutions with the criticality of the data being protected.
Full Backup
Captures the entire database
Basis for other types of backups
Incremental Backup
Captures changes since the last backup
More storage-efficient
Differential Backup
Captures changes since the last full backup
Faster restoration than incremental backups
Physical Backup
Copying database files
Suitable for large databases
Examples: OS copy, RMAN for Oracle
Logical Backup
Exporting database objects and data
Portable across different database systems
Examples: mysqldump, pg dump
1. Risk Assessment
Identify potential threats (natural disasters, cyber-attacks, hardware failures)
Evaluate the likelihood and impact of each threat
2. Recovery Objectives
Recovery Time Objective (RTO): Maximum acceptable downtime before services are
restored
Recovery Point Objective (RPO): Maximum acceptable data loss in terms of time
4. Offsite Storage
Store backups in geographically diverse locations
Utilize cloud storage solutions for redundancy
5. Communication Plan
Establish clear communication channels for stakeholders
Provide regular updates during the recovery process
Include contact information for key personnel and vendors
Full Backup
Complete copy of the entire database
Basis for other types of backups
Pros: Comprehensive and simple to restore
Cons: Time-consuming and storage-intensive
Incremental Backup
Copies only the changes since the last backup
Pros: Saves storage space and quicker backups
Cons: Longer recovery times as multiple backups may need to be
restored
Differential Backup
Copies changes since the last full backup
Pros: Faster recovery than incremental backups
Cons: Storage requirements increase with time since the last full
backup
Continuous Backup
Captures all changes to the database as they happen
Pros: Minimizes data loss, real-time recovery
Cons: Requires significant storage and network resources
Minimizing Downtime
Identifies potential issues in the recovery process before a disaster occurs.
Ensures a quicker and more efficient recovery, reducing downtime.
Regulatory Compliance
Many industries have regulations requiring regular testing of backup and recovery plans.
Ensures compliance with legal and regulatory requirements.
Improving Procedures
Identifies gaps and weaknesses in existing backup and recovery procedures.
Provides an opportunity to improve and update the procedures.
Scalability
Easily scales to accommodate growing data volumes.
Adapts to changes in the IT environment with minimal manual intervention.
Supports complex and large-scale backup operations.
Rapid Recovery
Speeds up the recovery process by automating restoration tasks.
Reduces downtime and minimizes the impact on business operations.
Enables quick and efficient disaster recovery.
Scalability
Easily scales to accommodate growing data volumes
Adapts to changes in the IT environment
Full Backups
Backs up all data at once
Typically scheduled periodically (e.g., weekly)
Incremental Backups
Backs up only the data that has changed since the last backup
Reduces backup time and storage space
Differential Backups
Backs up data changed since the last full backup
Balances between full and incremental backups
1 # Install Bacula
2 s u d o apt−g e t install bacula
3
4 # Configure Bacula Director for automated backups
5 vim / e t c / b a c u l a / b a c u l a −d i r . c o n f
6
7 # Define backup job
8 Job {
9 Name = ” B a c k u p C l i e n t 1 ”
10 JobDefs = ” DefaultJob ”
11 F i l e S e t=” F u l l S e t ”
12 Schedule = ” WeeklyCycle ”
13 Storage = F i l e
14 Messages = Standard
15 Pool = D e f a u l t
16 P r i o r i t y = 10
17 }
18
19 # Reload Bacula Director
20 s u d o s y s t e m c t l r e l o a d b a c u l a −d i r e c t o r
21
Objective
Implement a backup and recovery strategy for a database system, ensuring both data integrity
and security.
Instructions
1 Backup Strategy:
Schedule regular full and incremental backups using an automated tool (e.g., Bacula, pgBackRest).
Ensure that backups are stored in a secure location with appropriate access controls.
2 Security Measures:
Encrypt backups to protect sensitive data.
Implement access control to restrict who can initiate and restore backups.
Ensure backups are transferred and stored securely to prevent unauthorized access.
3 Recovery Plan:
Document the steps required to restore the database from a backup.
Test the recovery process regularly to ensure it works as expected.
Implement measures to verify the integrity of restored data.
4 Compliance:
Ensure the backup and recovery strategy complies with relevant regulations (e.g., GDPR, HIPAA).
Maintain logs and audit trails for backup and recovery operations.
Deliverables
A documented backup and recovery plan.
Scripts or configuration files for automated backups.
A report on the security measures implemented for backups.
Evidence of a successful recovery test.
Recovery Plan
Documentation: - Detailed documentation outlining step-by-step recovery procedures.
Testing: - Monthly recovery tests conducted to verify the integrity of backups and
recovery procedures.
Data Integrity Verification: - MD5 checksums are used to verify the integrity of restored
data.
Conclusion
The implemented backup and recovery strategy ensures data availability, integrity, and security,
meeting both regulatory requirements and organizational needs.
Key Takeaways
Importance of Backup and Recovery: Essential for data protection
and business continuity.
Types of Backups: Full, incremental, and differential backups each
serve different purposes.
Automated Tools: Utilize tools like Bacula, Veeam, and Acronis to
streamline backup processes.
Recovery Processes: Understand and implement Recovery Point
Objective (RPO) and Recovery Time Objective (RTO).
Regular Testing: Regularly test backup and recovery procedures to
ensure reliability and compliance.