Tuesday, March 28, 2023

What are different types of backups and distinguish among them?

There are many different types of backups that you can use to meet your backup and restore needs. The choice of which are available to you depends on the database system that you are using. The commonly used types include. 

  • Full back up: A full backup is a complete copy of all data in the object or objects being backed up. It simplifies the restore and recovery processes because you only need to locate the most recent full backup and restore that single file. However, as the size of your database grows, so do the time, bandwidth, and storage requirements for the backup file. Furthermore, if you decide to keep previous backup copies for safety, you will be storing many instances of a large file. If you only keep one copy, you must accept the risk that if the backup file becomes corrupt, you will be unable to restore your data. Consider that if only a subset of your data changes on a regular basis. You could be redundantly backing up the same data. Storing a complete copy of your data outside of the RDBMS requires you to ensure that it is adequately secured, and the unauthorized users cannot access it. When you restore a full back up, you return the data to the state it was in at the time the backup was taken. However, the database may have processed numerous transactions since then, which should ideally be restored as well.
  • Point in time backup: One solution is to enable logging for each transaction in your database, and then use the information in the log file to reapply the transactions to the restore database. The process of reapplying transactions after restoring a database backup is known as recovery, and it allows you to restore the data to the state it was in at a specific point in time, thus the name point-in-time recovery. For example, if you know that a DML statement executed at 11:05am deleted some data inadvertently, you can restore the most recent full backup and then reapply the transactions up to that point in time, minimizing the loss of data changes that occurred between the last full backup and the moment that the wrong data was deleted.
  • Differential backup: A differential backup is a copy of any data that has changed since the previous full backup. The differential backup file is much smaller than a full backup file, reducing backup time, bandwidth, and storage requirements while still allowing you to restore a recent copy of the data. For example, you could run a full back up once a week on Sunday, followed by a differential backup every day of the week. Each differential backup contains all of the changes that have occurred since the full back up on Sunday, so if you need to restore the database on a Tuesday, you must first restore the full back up from Sunday and then restore the differential backup from Tuesday.
    You do not need to restore Monday’s differential backup, because all the changes in that file are also included in the differential backup from Tuesday.
  • Incremental backup: Incremental backups are similar to differential backups in that they only contain data that has changed since the last backup of any kind. For example, you could run a full backup on a Sunday once a week and then an incremental backup every day of the week. Each incremental backup only contains changes since the previous day's backup, so if you need to restore the database on a Tuesday, you must first restore the full back up from Sunday, then the incremental backup from Monday, and finally the incremental backup from Tuesday. Restoring data from full and incremental backups will take longer than simply restoring a full backup or differential backups, but the time spent performing incremental backups is likely to be less than needed for a differential backup.

Note: Different database systems use different terminology for the log containing the transaction information, for example, MySQL calls it the binary log, Postgres calls it the write-ahead log, and Db2 on Cloud calls it the transaction log. Database transaction logs keep track of all activities that change the database structure and record transactions that insert, update, or delete data in the database.

Difference between hot backups and cold backups:

Hot BackupsCold Backups
Hot backups, or online backups, are those performed on data when it is in use. Cold backups, or offline backups, are those performed on data when it is not in use. 
The advantage of hot backups is that they have no impact on availability and users can  continue with their activities throughout the backup periodAvailability is impacted and users are unable to access  in 24/7 environments
hot backups can result in performance degradation for users while the backup is running and can impact on data integrity if data changes during the backup process. Data Integrety is eliminated as the backup is taken offline.
it is stored on the available serversit is stored on external drivers or on the server which is shut down between the backup's operations.
Lesser data safetyGreater data safety

Summary:

  • Full backups are simple to create and restore but can be slow to run and result in large files. 
  • Point-in-time recovery provides a more granular recovery model than just using full database backups. 
  • Differential backups are quicker to run than full backups, but the restore process can take longer.
  • Incremental backups are even quicker to run, but the restore process can take even longer.
  • Hot, or online, backups allow data to be backed up while the database is active, whereas cold backups require the database to be offline.
  • The backup policy should be determined from recovery and availability needs and data usage patterns. Most managed cloud databases provide automated backup functionality with some configurable options.


No comments:

Post a Comment

Introduction to Database Management System

 A Database Management System (DBMS) is a collection of programs that enables user to create and maintain a database. The DBMS is a general-...