473,569 Members | 2,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2789
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.COLIDENT ATTRIBUTES.SEQI D

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.COLIDENT ATTRIBUTES.SEQI D

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
4594
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 access to (some) packages. When the tables are in anoter schema than the packages, where should the table-API (generated from Designer) be?
2
7536
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 amount of data so I'm not interested in BulkXMLLoad (or whatever its called). 3. I have the xml and xml schema ready to go, with (I hope) the proper...
3
2647
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 into a SELECT INTO .... FROM FINAL TABLE and then try to _precompile_ it, I get the following: SQL0545N (invalidates check constraint). If I try to...
3
8082
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 dataset.WriteXml(@"C:\Data.xml"); dataset.WriteXmlSchema(@"C:\Schema1.xml");
7
6213
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 in the same format as the XSD (the XML file/string was created using this same schema). The XML file/string may contain data for a single table or...
4
1873
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 Schema file (xsd) for a table in my database. I then create a DataSet that contains 1 row of data from that same table. I want to use this DataSet along...
6
10656
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 data on the datasource. It simply gets the first name and last name of an instructor and displays it in the grid. I have two major problems.... One,...
13
1899
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. Suffice to say that ADO.Net 1.1 is unaware that this column is, despite appearances, optional - which is a problem when creating new rows. I was...
1
9235
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 for testing and developing our application. - Unfortunately I have a 80GB HD and the DWH contains a few 'tera'.
0
7695
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8119
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.