473,395 Members | 1,629 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,395 software developers and data experts.

How to change schema of table in DB2 v.8.2 without coping data

Hallo all

Is it possible to change schema of table in DB2 v.8.2 without
recreating and coping a table into a new schema?

I need it for several purposes, one of them - refactoring of existing
old database with more then 250 tables. I would like to split it to
subsystems, but some of tables are quite large.

And the size of tables prevents me from getting copy of production
database for our test envi-ronment. Total backup is almost 500 Gbytes.
But 98% of these data are stored in 3 tables, which are just archive.
So I planned:
1) move them to another schema,
2) create views in old schema, which will point to a new,
3) create a new user, which will have read access only to old schema.

So I will be able to make a backup under this new user with almost all
tables but much less then 500GB.

Why don't I use IMPORT/EXPORT? Because a lot of tables have IDENTITY
GENERATED ALWAYS, so I have conflicts in IDs when I load exported
data. Also, db2move tool allows only 10 table names to be specified at
a time...

But may be there are another ways to make partial backup of the big
database? And another way to refactor it to group tables by systems
else then by schemas?
Thank you in advance!
Jun 27 '08 #1
5 2779
Why don't I use IMPORT/EXPORT? Because a lot of tables have IDENTITY
GENERATED ALWAYS, so I have conflicts in IDs when I load exported
data. Also, db2move tool allows only 10 table names to be specified at
a time...
Why don't you use LOAD instead of IMPORT. It is faster and can handle
generated columns just fine.

Also IIRC you can drop (and add) the identity property in DB2 8.2.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jun 27 '08 #2
On Apr 16, 5:31 pm, Serge Rielau <srie...@ca.ibm.comwrote:
Why don't I use IMPORT/EXPORT? Because a lot of tables have IDENTITY
GENERATED ALWAYS, so I have conflicts in IDs when I load exported
data. Also, db2move tool allows only 10 table names to be specified at
a time...

Why don't you use LOAD instead of IMPORT. It is faster and can handle
generated columns just fine.

Also IIRC you can drop (and add) the identity property in DB2 8.2.
Slightly offtopic, but ... I assume IDENTITY GENERATED ALWAYS is
implemented via a sequence, correct? If so, is it possible to
determine which sequence that is used for a table?
/Lennart

Jun 27 '08 #3
Lennart wrote:
Slightly offtopic, but ... I assume IDENTITY GENERATED ALWAYS is
implemented via a sequence, correct? If so, is it possible to
determine which sequence that is used for a table?
SYSCAT.COLIDENTATTRIBUTES.SEQID

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jun 27 '08 #4
On Apr 16, 5:31 pm, Serge Rielau <srie...@ca.ibm.comwrote:
Why don't I use IMPORT/EXPORT? Because a lot of tables have IDENTITY
GENERATED ALWAYS, so I have conflicts in IDs when I load exported
data. Also, db2move tool allows only 10 table names to be specified at
a time...

Why don't you use LOAD instead of IMPORT. It is faster and can handle
generated columns just fine.
Don't know what happened to my post. Here it goes again. I assume
identity columns are implemented using a sequence (correct?). If so,
is it possible to determine which sequence that is connected to a
identity column?

/Lennart
Jun 27 '08 #5
On Apr 18, 1:24 pm, Serge Rielau <srie...@ca.ibm.comwrote:
Lennart wrote:
Slightly offtopic, but ... I assume IDENTITY GENERATED ALWAYS is
implemented via a sequence, correct? If so, is it possible to
determine which sequence that is used for a table?

SYSCAT.COLIDENTATTRIBUTES.SEQID

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Thanx
/Lennart
Jun 27 '08 #6

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

Similar topics

1
by: bdj | last post by:
Hello! Can anyone tell me where to read more about best practices about this: Should I put data in a seperate scheme for tables, packages in anoter schema and create a lot of users that have...
2
by: Json | last post by:
Ok, brand new to SQLXML 3.0 and its various issues. Heres what I'm trying to do: 1. I am trying to load xml data into an empty SQL table from my .NET console application. 2. This isn't a huge...
3
by: Almund Sebi | last post by:
Hello I use DB2 UDB V8.1.5. Using embedded SQL (SQLJava), I insert a row into a table which has some foreign keys and check constraints. The insert works fine, but if I encapsulate the insert...
3
by: Kiran | last post by:
Hi, I want to back up my data in some table in SQL server and import it back using Bulk Load of SQL server 2K. I can use the following code to backup the data in XML ...
7
by: Sharon | last post by:
I have successfully loaded a DataSet object with a XML schema (XSD). Now I wish to populate the tables that was created in the DataSet. I have an XML file/string that contain all the needed data...
4
by: Sindarian | last post by:
This just seems like the most basic thing, but I can't find a simple description of this process anywhere and in here, everone is talking about going the other way :( I had .NET create an XML...
6
by: Aaron Smith | last post by:
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the...
13
by: Martin Z | last post by:
I'm making a CRUD screen for an Oracle database... but problem is that the primary key in that table is populated via an autonumber, which in Oracle is done just with triggers and sequences. ...
1
by: Raoul Minder | last post by:
Sorry for the sender name, just set up my news account... Hi all Probably an easy question for an oracle dba or even power user: I would like to copy the data warehouse schema on my laptop...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.