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 > redirected restore

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-23-04, 17:06
mark_maz mark_maz is offline
Registered User
 
Join Date: Feb 2002
Location: Hamilton
Posts: 138
redirected restore

I used the following guidelines to do a redirected restore.

http://www-106.ibm.com/developerwork...2mulligan.html

It worked after I manipulated the files for the new environment, however I noticed that the schema for the tables is still the old instance name ie

source server instance name - avcpb1
source server database name - avc

target server instance name - avcd2
target server database name - avc

but when I check the tables by doing a db2 list tables for all I see the following:


Table/View Schema Type Creation time
------------------------------- --------------- ----- --------------------------
ADVISE_INDEX AVCPB1 T 2004-07-16-11.35.49.392654
ADVISE_WORKLOAD AVCPB1 T 2004-07-16-11.35.49.427523
APPLICATION_GROUP AVCPB1 T 2003-08-28-16.40.27.142362
ARCHIVE_SITE AVCPB1 T 2003-08-28-16.40.27.180912

But I would like to see the tables owned by the user avcd2, is there any quick way of changing the schema during the redirected restore or afterwards?

thanks

mark
Reply With Quote
  #2 (permalink)  
Old 09-23-04, 17:43
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
A redirected restore is just that - a restore. It will re-create the original database in different containers but won't change the contents of the database itself.

On the other hand, schema name in general has nothing to do with instance owner userid, or any other userid. It just so happens that if you fail to specify schema name while creating a table DB2 will choose one for you, which happens to be your userid. It might have been something like IBM0012345.

As a result, I guess the only way to change schema name of an existing table is to drop and re-create the table...
Reply With Quote
  #3 (permalink)  
Old 09-24-04, 17:17
dbamota dbamota is offline
Registered User
 
Join Date: Sep 2003
Posts: 237
you can give the right access(select,insert etc) to avcd2 on all tables; then if your program refers to just tablename, you can set CURRENT SCHEMA = "avcpb1" ; CURRENT SCHEMA is an environmental variable; IF it refers to
avcpb1.tn1 then you can create an alias ; "create alias avcd2.ADVISE_INDEX for AVCPB1.ADVISE_INDEX " and so on ; now when you say avcd2.ADVISE_INDEX in any sql, db2 will look for AVCPB1.ADVISE_INDEX ; typically, if it is an ERP package, there is an interface file giving the schema name of the tables. you have to put "AVCPB1" for the schema name
__________________
mota
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