If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Restore Problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-02-08, 19:15
jyoung jyoung is offline
Registered User
 
Join Date: Jul 2005
Posts: 31
Restore Problem

I am attempting to restore from a backup of one database to another database. I used the following:
db2 restore database prod user .... using .... taken at 20080227132810 into test replace existing without rolling forward
I get the following error:
SQL0294N The container is already in use. SQLSTATE=42730

I am sure it is something stupid that I am doing. Thank you.
Reply With Quote
  #2 (permalink)  
Old 03-03-08, 02:25
guyprzytula guyprzytula is offline
Registered User
 
Join Date: Jun 2006
Posts: 471
or there is another db using the container path and redirected restore is needed
or just drop the db test and restore the other db, because of the layout I presume
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
Reply With Quote
  #3 (permalink)  
Old 03-03-08, 07:09
jyoung jyoung is offline
Registered User
 
Join Date: Jul 2005
Posts: 31
Hi guyprzytula,
Thank you for your response. I probably should have given more information. What I am attempting to do is restore the database TEST from a backup taken of the database PROD. What would be the correct syntax of the restore command to accomplish this? The TEST database is or should be the same as PROD. I am using DB2 version 8.1.1.56 fixpack 6.

Last edited by jyoung; 03-03-08 at 07:12.
Reply With Quote
  #4 (permalink)  
Old 03-03-08, 07:14
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
The naming of the databases is pretty much irrelevant here. The problem you have is that the database to be restored refers to the same physical file as some other database residing on the same system. Since a single file can only be used by one database, DB2 won't let you override an existing file with the files from the database to be restored. So you have to do a "redirected restore" - as Guy explained - in order to redirect the file names in the backup image to new file names for the restored database.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #5 (permalink)  
Old 03-03-08, 07:52
jyoung jyoung is offline
Registered User
 
Join Date: Jul 2005
Posts: 31
Hi stolze,
Thank you for your response. I will check my documentation on how to perform a "redirected restore" and see what happens.
Reply With Quote
  #6 (permalink)  
Old 03-03-08, 08:56
jyoung jyoung is offline
Registered User
 
Join Date: Jul 2005
Posts: 31
Ok, I have dropped the TEST database. Now I want to restore the backup of the PROD database to TEST and I want to make sure that the containers go into a specific directory. For the data portion I want them in /db2test/data. For the index portion /db2test/index. What would be the restore command for that? Thank you.
Reply With Quote
  #7 (permalink)  
Old 03-04-08, 00:46
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by jyoung
Ok, I have dropped the TEST database. Now I want to restore the backup of the PROD database to TEST and I want to make sure that the containers go into a specific directory. For the data portion I want them in /db2test/data. For the index portion /db2test/index. What would be the restore command for that? Thank you.
During a restore operation, you can rellocate a particular tablespace, but you cannot rellocate a table (or indexes within a table) unless the data and indexes are already pointed to different tablespaces.

You could change the schema definition to point the tables and indexes to different locations and then reload all the data with a db2move.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #8 (permalink)  
Old 03-04-08, 05:14
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Quote:
Originally Posted by jyoung
Ok, I have dropped the TEST database. Now I want to restore the backup of the PROD database to TEST and I want to make sure that the containers go into a specific directory. For the data portion I want them in /db2test/data. For the index portion /db2test/index. What would be the restore command for that?
Have a look at the Command Reference. It explains in detail how to invoke a redirected restore, to do the actual redirection, and then how to continue the restore.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #9 (permalink)  
Old 03-04-08, 06:46
jyoung jyoung is offline
Registered User
 
Join Date: Jul 2005
Posts: 31
Thank you both for your responses. I will take a look at the command reference.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On