Reputation: 17
I have one database under instance db2inst4 and I want to copy that db to another instance, db2inst1. I made a backup with the following command
db2 backup db TDB online
Backup successfull. The timestamp for this backup image is : 20200109121153
after this I tried to restore the bck into the db2inst1
db2 restore database TDB from /appsdata/db2inst4/ taken at 20200109121153 dbpath on /appsdata/db2inst1
DB20000I The RESTORE DATABASE command completed successfully
The restore was successful apparently. But when I check in the db2inst1 to see if the TDB database is there, i get the following
[db2inst1@xxx~]$ ./db2 list db directory
SQL1057W The system database directory is empty. SQLSTATE=01606
i don't know what am I missing
Upvotes: 0
Views: 648
Reputation: 31
Were you definitely using db2inst1 at the time the RESTORE cmd was issued, either with echo $DB2INSTANCE
or the get instance
command?
Otherwise the restore utility could have checked the environment of your current instance, determined that your TDB DB already exists there, and restored it as you asked.
Also, just changing the dbpath is not necessarily sufficient as you may also need to redirect the tablespace containers, and there can be other considerations. For instance, see:
Upvotes: 2