Unanswered: problems in restoring 1 database to anothar
I have one database db_1 at an instance db2admin on aix sever. I create anothar database db_2 at the same instance. If I want to replicate db_1 to db_2 , I have to use db2look to generated ddl statements, then have to export data to csv files for db_1 & import the same to db_2. Then I have to run the ddl script, removing code ofr freign keys & constraints. After data is imported , I have to create the constraints. Afet this I have to copy the stored procedures one by one from db2spb from 1 db to anothar. This method is cumbersome & time consuming. So I tried using restore
restore database db_1 user username using password from <backup location> taken at <timestamp> into db_2;
The aix server reponded : The container is in use
So I changed the container location of the new db and tried using restore database db_1 user username using password from <backup location> taken at <timestamp> to < container location of new db> into db_2 redirect
But the Aix server asks to load some volume.
So , Is there any way in which my entire backup of database ,table structure with all constraints can be replicated to anothar database on same or other instance easily?
you have to do a "redirected restore", you must set for ALL tablespace containers the new location.
restore db db_1 from /db2back into db_2 redirect;
-- set container-paths for all not default tablespaces
-- DMS 1 contaner
set tablespace containers for 2 using (device '/dev/rlv_1TSTDB002_01' 16384) ;
-- DMS 2 container
set tablespace containers for 4 using (device '/dev/rlv_1TSTIN001_01' 8192,device '/dev/rlv_1TSTIN001_02' 8192) ;
set tablespace containers for 115 using (PATH '/insthome/db2inst1/db2inst1/afisp/TSG02') ;
-- and so on