DB2LUW Simple steps to do backup/restore with Native Encrypted database
Biswarup(Bis)Mukherjee 120000HKTY Visits (1148)
Creating this blog entry as I noticed there are confusions in place on how to simply backup a native encrypted db2
There are good documents in IBM site where steps are there when backup itself to be encrypted, or steps might not have specific details,
Export the Encryption Key from source :
db2 connect to <source-db-name>
db2 -x "select master_key_label from tabl
This will give a result with a long key level which is used in export of the appropriate item from the keystore using the full path to the binaries so the proper gskit libraries are referenced:
NOTE The thedb.key is not password-protected and does contain the encryption key that would allow your database to be restored elsewhere. Take appropriate precautions when storing or moving it.
db2 backup database <db-name>
Copy the thedb.key and backup image file to the target box and keep in a temp path.
Import the key in target from temp path to the local existing key store.
db2 restore db <db-name> encrypt
If there are no databases in target then just need to copy the entire keystore file from source to target and run simple backup and restore with just encrypt option for the restore.