473,385 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Restoring a database to a test system, handling schema differences

I've got a database backup from another system which I'd like to restore
to a test system. Both the backup and restore systems are Solaris 8. I
don't recall the DB2 version, but I do know that the backup and restore
versions match. If it matters, I'm only accessing this db via the UNIX
command line, and then programmatically via JDBC (by an app that does
all the actual queries and updates).

I do not have access to the original system.

The problem I'm having is that the tables are being created attached to
a schema that does not exist on my test system. This is probably due to
the fact that the instance names are different. That is, the table is
started and altered by a "userid1" user, so table foo is accessed via
USERID1.FOO. Of course, the default instance or userid I'm testing with
is something like "clvrmnky", so the default tables are never found.

Is there a way to change the problem table schema to something else on
restore? Can this be changed in the backup image?

Should I just create a new instance name that matches the schema?

Should I just alter every single table so that it is essentially moved
to the a new schema I create?

I looked a bit into a redirected restore, but this seems to concern
itself more with the locations of tablespaces. This does not seem to be
my problem.

--
cm
Nov 12 '05 #1
6 3612
On 19/04/2004 6:00 PM, clvrmnky wrote:
I've got a database backup from another system which I'd like to restore
to a test system. Both the backup and restore systems are Solaris 8. I
don't recall the DB2 version, but I do know that the backup and restore
versions match. If it matters, I'm only accessing this db via the UNIX
command line, and then programmatically via JDBC (by an app that does
all the actual queries and updates).

I do not have access to the original system.

The problem I'm having is that the tables are being created attached to
a schema that does not exist on my test system. This is probably due to
the fact that the instance names are different. That is, the table is
started and altered by a "userid1" user, so table foo is accessed via
USERID1.FOO. Of course, the default instance or userid I'm testing with
is something like "clvrmnky", so the default tables are never found.

[...]
Note to self: just create aliases to the tables in question with the
"correct" schema name. Feeding "db2 create alias ..." a list of tables
in a shell script loop did the trick.
Nov 12 '05 #2
On 19/04/2004 6:00 PM, clvrmnky wrote:
I've got a database backup from another system which I'd like to restore
to a test system. Both the backup and restore systems are Solaris 8. I
don't recall the DB2 version, but I do know that the backup and restore
versions match. If it matters, I'm only accessing this db via the UNIX
command line, and then programmatically via JDBC (by an app that does
all the actual queries and updates).

I do not have access to the original system.

The problem I'm having is that the tables are being created attached to
a schema that does not exist on my test system. This is probably due to
the fact that the instance names are different. That is, the table is
started and altered by a "userid1" user, so table foo is accessed via
USERID1.FOO. Of course, the default instance or userid I'm testing with
is something like "clvrmnky", so the default tables are never found.

[...]
Note to self: just create aliases to the tables in question with the
"correct" schema name. Feeding "db2 create alias ..." a list of tables
in a shell script loop did the trick.
Nov 12 '05 #3
Ian
clvrmnky wrote:
On 19/04/2004 6:00 PM, clvrmnky wrote:
I've got a database backup from another system which I'd like to
restore to a test system. Both the backup and restore systems are
Solaris 8. I don't recall the DB2 version, but I do know that the
backup and restore versions match. If it matters, I'm only accessing
this db via the UNIX command line, and then programmatically via JDBC
(by an app that does all the actual queries and updates).

I do not have access to the original system.

The problem I'm having is that the tables are being created attached
to a schema that does not exist on my test system. This is probably
due to the fact that the instance names are different. That is, the
table is started and altered by a "userid1" user, so table foo is
accessed via USERID1.FOO. Of course, the default instance or userid
I'm testing with is something like "clvrmnky", so the default tables
are never found.

[...]
Note to self: just create aliases to the tables in question with the
"correct" schema name. Feeding "db2 create alias ..." a list of tables
in a shell script loop did the trick.


Or, write your queries to use fully qualified table names. As in,
'select * from userid1.foo' instead of 'select * from foo'

Good luck,


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #4
Ian
clvrmnky wrote:
On 19/04/2004 6:00 PM, clvrmnky wrote:
I've got a database backup from another system which I'd like to
restore to a test system. Both the backup and restore systems are
Solaris 8. I don't recall the DB2 version, but I do know that the
backup and restore versions match. If it matters, I'm only accessing
this db via the UNIX command line, and then programmatically via JDBC
(by an app that does all the actual queries and updates).

I do not have access to the original system.

The problem I'm having is that the tables are being created attached
to a schema that does not exist on my test system. This is probably
due to the fact that the instance names are different. That is, the
table is started and altered by a "userid1" user, so table foo is
accessed via USERID1.FOO. Of course, the default instance or userid
I'm testing with is something like "clvrmnky", so the default tables
are never found.

[...]
Note to self: just create aliases to the tables in question with the
"correct" schema name. Feeding "db2 create alias ..." a list of tables
in a shell script loop did the trick.


Or, write your queries to use fully qualified table names. As in,
'select * from userid1.foo' instead of 'select * from foo'

Good luck,


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #5
Another option, which works in the CLP ('db2') at least: After connecting
to the db, issue the following command:

[ db2 ] set schema userid1

Regards,
-steve p.
-------------------
Steve Pearson
DB2 UDB Development
Portland, OR, USA
Nov 12 '05 #6
Another option, which works in the CLP ('db2') at least: After connecting
to the db, issue the following command:

[ db2 ] set schema userid1

Regards,
-steve p.
-------------------
Steve Pearson
DB2 UDB Development
Portland, OR, USA
Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Martin Hart | last post by:
Hi, postgresql 7.4beta4 on linux and postgresql 7.3.4 on linux We have a database that we routinely backup using "pg_dump -a" We have to do this (dump the data only) because of various...
0
by: clvrmnky | last post by:
I've got a database backup from another system which I'd like to restore to a test system. Both the backup and restore systems are Solaris 8. I don't recall the DB2 version, but I do know that...
19
by: Steve Jorgensen | last post by:
I've run across this issue several times of late, and I've never come up with a satisfactory answer to the best way to handle this schema issue. You have a large section of schema in which a...
4
by: m96 | last post by:
hi, i'm trying to make a query to a ldap server (version v2 or v3 doen't matter) with c#. the query works just fine but the problem is that i can't read the custom attributes/fields, since .net...
2
by: Fischer Ulrich | last post by:
Hi I have a problem with the restoring of a database which uses tsearch2. I made a backup as discribed in 'tsearch-v2-intro' on the tsearch2 page. Now i'm trying to restore it into a...
1
by: Robbert van Geldrop | last post by:
Hello, I have a problem restoring Exchange 2000 files. Our software has an interface to ESEBCLI2.dll for online backup and restore features. Everything works fine with Exchange 2003 and also...
1
by: aj | last post by:
DB2 LUW 8.2 FP14 Red Hat AS 2.1 I went to restore a backup of my production DB on my test/developmental server. The backup on the prod system was taken /before/ alt_obj() was used there to do...
5
by: Troels Arvin | last post by:
Hello, Every so often, I'm asked to help people recover data from tables that were either dropped or where to much data was DELETEed. The complications related to restoring data are a problem....
17
by: darien.watkins | last post by:
Kindof a poll, kindof curiosity... What is your favorite python - database combination? I'm looking to make an app that has a local DB and a server side DB. I'm looking at python and sqlite...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.