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 > Redirect a Restore to a new database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-23-08, 10:22
itsonlyme44 itsonlyme44 is offline
Registered User
 
Join Date: Dec 2007
Posts: 261
Redirect a Restore to a new database

We are running DB2 UDB V8 on Windows. Trying to figure out how to re-direct a restore to a new Database in the same instance.

Do I create a new DB first? Should I let the restore create the database? Can anyone guide me through the steps neede to do this?
Reply With Quote
  #2 (permalink)  
Old 04-23-08, 12:18
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
Let redirect do the work. Look up RESTORE command. Followed by SET TABLESPACE CONTAINERS command. Followed by ROLLFORWARD.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #3 (permalink)  
Old 04-23-08, 15:57
itsonlyme44 itsonlyme44 is offline
Registered User
 
Join Date: Dec 2007
Posts: 261
Thanks.. so there is no way to do it through the control center? I was thinking create a new empty database and then restore a backup from the source database to it... but it won't let me.
Reply With Quote
  #4 (permalink)  
Old 04-23-08, 16:27
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
The whole idea about a restore is that you hae no database to begin with. If you create something how is it going to work?

Your other choice, which I hope you do not take, is to create blank db and then do db2move to export and import.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #5 (permalink)  
Old 04-24-08, 03:14
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
You can restore to an existing database, that will effectively wipe out the existing db (including all containers and tablespaces). So why waste the time in creating it in the first place?
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #6 (permalink)  
Old 04-24-08, 07:34
itsonlyme44 itsonlyme44 is offline
Registered User
 
Join Date: Dec 2007
Posts: 261
Than you!! I guess what I'm confused about is the CONTAINERS tab when I do a restore to a NEW Database. Do I have to specify new containers for a redirected restore?

Options are *Enable table space containers to be redirected during restore operation.
*Allow new container creation during roll-forward

Then it asks you to select the table space with containers to be redirected and then to specify the containers..

I just want to make sure that I'm doing it correctly so that I'm not overwriting anything in the source DB and just making a copy of it.. Sorry if this all sounds dumb.. but I'm a true newbie at UDB
Reply With Quote
  #7 (permalink)  
Old 04-25-08, 16:56
akratz akratz is offline
Registered User
 
Join Date: Aug 2002
Posts: 76
It will not let you rewrite a container in the new database over the old one. It will recognize the contention and the tablespace with be in a Must Have Containers Defined state until you successfully complete the redirect.

Here is a sample of one i did last week

db2 "restore db reportt into kratz redirect"
db2 "set tablespace containers for 0 USING (Path '/u03/SHAZAMD1/KSYSCAT/SQLT0000.0')"
db2 "set tablespace containers for 25 USING (File '/u03/SHAZAMD1/KRATZTS' 384000 )"
db2 "set tablespace containers for 1 USING (File '/u03/SHAZAMD1/acktempSpaceTs01' 512032)"
db2 "set tablespace containers for 3 USING (Path '/u03/SHAZAMD1/KUSERSPACE/QCTEMPTS')"
db2 "set tablespace containers for 6 USING (Path '/u03/SHAZAMD1/KUSERSPACE/SQLT0001.0')"
db2 "set tablespace containers for 18 USING (Path '/u03/SHAZAMD1/KUSERSPACE/temp32')"
db2 restore db reportt continue

So you do the restore redirect first. Then you set containers for the tablespaces you want to redirect, then you tell it to continue. Note on the continue, you are continuing a restore against the original db name and not the source db name.
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