473,799 Members | 3,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change a table's tablespace

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
3 21335
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3262
by: Paul Hallam | last post by:
How does oracle distribute records in a table that is in a tablespace with multiple datafiles. Very simplisticly Ingres will distribute sequential records evenly across multiple datafiles for a single table. (Not exact but good enough for this question.) How does oracle distribute records for a table that is in a tablespace with multiple datafiles.
1
5022
by: xixi | last post by:
There is one thing I don't understand, I have default tablespace userspace1 is database managed type, with total freepages 506048. another one called tmpxx is DMS type too, with 525120 free pages. When I create a new table (did not specify on which tablespace), why the table not created on the userspace1 but instead on tmpxx? what is the rule to create a table on tablespace without specify in which tablespace if I have both tablespace...
4
5878
by: maricel | last post by:
Could someone confirm which tablespace is being used when running ALTER & CREATE INDEX. Is it the tempspace or the tablespace where the table resides? Many thanks, maricel
6
5740
by: robert | last post by:
just got out of a "class" on EXPLAIN, from a 390/v6 maven. was told that ACCESSTYPE = 'R' in the plan_table meant a TableSpace scan. hmmmm. next step up (or down, depending on your outlook) wasn't a Table Scan. thought this might be a MainFrame thing; but a look at DB2Info on my UDB 7.2 server showed the same thing. this is truly puzzling. is there an explanation of EXPLAIN which describes how to get a Table Scan???? or are we...
2
10265
by: Stanley Sinclair | last post by:
About to create a table which will "include" a BLOB. Am not sure how large to make the container and the tablespace. What I see says that BLOB is stored "separately." However, I don't know where. With a table kinda like: CREATE TABLE BLOB_TABLE ( BLOB_ID INT,
5
3320
by: Christian Traber | last post by:
Hi! just playing with tablespaces... - moved a existing table to a new tablespace - tried to move it back to default tablespace (ALTER TABLE accounts SET TABLESPACE pg_default;) Got the following error in logfile:
12
18756
by: bikkaran | last post by:
Hi , I have a table that contains 15lakh records..... I want delete that table....and insert fresh set of record. when I run the command ...db2 "delete from schema.tabname" it hangs .......the system it seems hangs... Is their a better way out to delete the data..
5
6567
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. The SAS users are laughing because they can (to a certain extend) easily go back to an earlier SAS table by simply starting dsm. Of course, a flat file table is different than a relational table; but still, the trouble related to restoring DB2...
6
8080
by: shawno | last post by:
Hi, We're running DB2 v8.1 on a windows platform and have a database that is quite large. It basically contains one table with a BLOB field (each blob is a zip file, maybe 500K to 1MB), and this particular table is close to 300GB in size. We are not experiencing any problems, and there is plenty of space on the server, but I was just wondering if there is limit in DB2 to how big this table can get. We are guessing it is going to...
0
9688
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9546
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10247
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10031
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7571
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5593
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.