By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,610 Members | 2,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,610 IT Pros & Developers. It's quick & easy.

Change a table's tablespace

P: n/a
Hi,

i need to change the tablespace of a table, ie. use another tablespace
for the table and stop the use of the existing tablespace. Is there any
way i can accomplish this? One solution might be export the data from
the table, re-create the tables in the new tablespace, drop the
original tablespace and load the data. But i would prefer another
simple and less time-consuming way.

Any suggestions would be highly appreciated.

Thanks in advance,
Sandip.

Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
sandip wrote:
Hi,

i need to change the tablespace of a table, ie. use another tablespace
for the table and stop the use of the existing tablespace. Is there any
way i can accomplish this? One solution might be export the data from
the table, re-create the tables in the new tablespace, drop the
original tablespace and load the data. But i would prefer another
simple and less time-consuming way.


You could create a new table in the other tablespace

CREATE TABLE <new-table> LIKE <old-table> IN <new-ts>

copy the data

INSERT INTO <new-nable> SELECT * FROM <old-table>

correct foreign keys to point to the new table and then remove the old
table.

--
Knut Stolze
Information Integration Development
IBM Germany / University of Jena
Nov 12 '05 #2

P: n/a
sandip wrote:
Hi,

i need to change the tablespace of a table, ie. use another tablespace
for the table and stop the use of the existing tablespace. Is there any
way i can accomplish this? One solution might be export the data from
the table, re-create the tables in the new tablespace, drop the
original tablespace and load the data. But i would prefer another
simple and less time-consuming way.

Any suggestions would be highly appreciated.

Thanks in advance,
Sandip.

You can do a "load from cursor". One way or another the data needs to move.

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #3

P: n/a
If the tablespace exists in the same instance, you can do it from
control center. Right click, copy table, enter new table/tablespace
name. then delete old and rename new table name to old table name.

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.