Restore to Original Server
You can restore IBM Db2 databases from backups stored on Veeam backup repositories in the following ways:
To restore a IBM Db2 database from a full backup, use the following command:
db2 restore db <database_name> load /opt/veeam/VeeamPluginforDB2/libDB2Plugin.so taken at <timestamp> |
where:
- <database_name> is a name of the database you want to restore.
- <timestamp> is a time stamp that IBM Db2 generates for each backup in the yyyymmddhhmmss format. Veeam Plug-in will restore database from the backup file created at the time that you specify in the command.
To learn how to get time stamp, see Get Backup Time Stamp.
Restore from Incremental Backup
To restore a IBM Db2 database from a full backup, use the following command:
db2 restore db <database_name> incremental automatic load /opt/veeam/VeeamPluginforDB2/libDB2Plugin.so taken at <timestamp> |
where:
- <database_name> is a name of the database you want to restore.
- <timestamp> is a time stamp that IBM Db2 generates for each backup in the yyyymmddhhmmss format. Veeam Plug-in will restore database from the backup file created at the time that you specify in the command.
To learn how to get time stamp, see Get Backup Time Stamp.
You can restore the database to the previous states. In this case, you restore database from a backup, then apply archive logs that are available in the backup file. With these archive logs, you can restore database to the exact state when the backup was created.
Important |
To restore database to the previous state, you must use a full online backup of the database. To learn more, see Performing Full Backup. |
To restore database to the previous state, do the following steps:
- Restore to the previous state requires downtime. Terminate all existing connections and deactivate the database with the following commands:
db2 terminate db2 deactivate database <database_name> |
where <database_name> is a name of the database you want to deactivate.
- Extract archive logs from the backup file with the following command:
db2 restore database <database_name> logs load /opt/veeam/VeeamPluginforDB2/libDB2Plugin.so LOGTARGET <path_to_logs> |
where:
- <database_name> is a name of the database you want to deactivate.
- <path_to_logs> is a path to the directory to which Veeam Plug-in will extract archive logs.
- Return the database to the state recorded in a backup with the following command:
db2 restore database <database_name> load /opt/veeam/VeeamPluginforDB2/libDB2Plugin.so taken at <timestamp> replace existing |
where:
- <database_name> is a name of the database you want to restore.
- <timestamp> is a time stamp that IBM Db2 generates for each backup in the yyyymmddhhmmss format. Veeam Plug-in will restore database from the backup file created at the time that you specify in the command.
To learn how to get time stamp, see Get Backup Time Stamp.
- Apply archive logs to return database to the exact state when the backup was created with the following command:
db2 rollforward database <database_name> to end of logs overflow log path (<path_to_logs>) |
where:
- <database_name> is a name of the database you want to deactivate.
- <path_to_logs> is a path to the directory to which Veeam Plug-in will extract archive logs.
- Recover the database with the following command:
db2 recover database <database_name> |
where <database_name> is a name of the database you want to deactivate.
- Re-activate the database with the following command:
db2 activate database <database_name> |
where <database_name> is a name of the database you want to deactivate.