To copy a backup to a different instance, you need to compress your backup images and add
them to the backup directory you want to restore from.
Procedure
-
Compress your backup images and keystore on the catalog node by using the following
command:
Important: You need to provide your keystore to be able to restore from a backup.
su - db2inst1
cd /backup_dir
tar -cvzf backup_nnn.tgz -C /backup_dir/backup_nnn .
# Examine the tar file and ensure it contains the backup images and keystore files
tar -ztvf backup_nnn.tgz
Perform an initial hash check with the following command and keep note of the output:
sha1sum backup_nnn.tgz
- Exit the session and copy the
tar locally by using the following
command:
mkdir /local/backup/dir/backup_nnn
oc rsync <db2 backup catalog pod>:/backup_dir/backup_nnn.tgz /local/backup/dir/backup_nnn
You can now safely delete the backup tar you created on the backup instance.
- Copy the
tar and add it to the backup directory of the instance you want
to restore. Refer to the following example:
oc rsync /local/backup/dir/backup_nnn <db2 restore catalog pod>:/backup_dir
Perform another hash check with the following command:
sha1sum backup_nnn.tgz
Compare the output of this hash check with the output of the initial hash check and confirm they
match.
You can safely delete the backup tar that you created on the backup instance
after you confirm that the hash checks match.
- Extract the
tar from the catalog node of the restored instance to the
backup directory. Refer to the following example:
su - db2inst1
sudo tar -xvzf backup_dir/backup_nnn/backup_nnn.tgz -C backup_dir/backup_nnn
You can now safely delete the backup tar you copied to the restore instance.
What to do next
Complete the steps to restore an external database. See Restoring Db2
Warehouse from an offline backup using the
restore script for more details.