Database backup creates a dataset image of a database, which is a basic component of a disaster recovery solution. DB2 provides several backups, including offline backup, online backup, and incremental backups. The time required from backup recovery depends on the size of the database and the hardware resources available to perform recovery.
Since the database backup captures only the data of the time point, it cannot be recovered by a simple recovery to recover any data changes that occur after the backup. To restore the transactions completed after the backup, you need to apply the log file. The database can be restored from backup and log files (by "pre-roll" in the log file). This allows recovery to a point in time or to return to the log file end.
Therefore, if the DR solution must restore transactions since the last backup, the reserved log file is very critical.
The recovery scheme can be divided into three categories:
§ Offline backup
§ Backup and log retention
§ logic backup
Offline backup
Create only database backups. Simple backups are suitable for read-only databases or databases that are filld by batch jobs that can be easily recreated, or without maintaining database changes between backups.
Data loss: All changes that occur after the last backup operation will be lost. Because this type of recovery operation restores the data to a specific time point for full backup, the version is also called version recovery.
Restore the required time: Database recovery takes a long time.
Online backup and log retention
Keep the database log file with a more complete DR solution with the database backup. The log file allows the recovery of data changes that occur between the backups. This solution is suitable for most environments for business matters. It balances the need for minimizing data loss risks and maintains the cost of the DR solution.
Data loss: If you use the appropriate step to maintain the log file, it will greatly reduce the risk of data loss.
Restore the required time: Database recovery takes time, the application log file will increase the recovery time.
The above two backup methods cannot be cross-platform.
Logical backup
The backup of the data (similar to Oracle EXP / IMP) is used using EXP / IMP or DB2MOVE.
Data loss: Data changes between backups may be lost.
Restore the required time: Database recovery takes a long time.
This backup method can be cross-platform. But backup and recovery have a long time, only database usage of small data.
Database log
DB2 has two ways of logging: loop and archive.
Cycle log:
The loop record is default attribute when a new database is created. For such logging, only complete offline backups are allowed.
Archive log:
When the database is configured to archive, online backup is supported. All activities of the database will be recorded during online backup operation. When restoring online backups, you must at least roll to the time point of completing the backup. Therefore, logs must be archived and available when logging in the database. After the online backup is complete, DB2 will force the current active log to make the log archive.