dbTalk Databases Forums  

Moving tables between tablespaces

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss Moving tables between tablespaces in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Troels Arvin
 
Posts: n/a

Default Moving tables between tablespaces - 08-18-2008 , 02:26 AM






Hello,

How does a use efficiently move a table between tablespaces, given that
the user doesn't have shell access to the server hosting the database?

Is there some built-in routine that the user can execute? - Such as a
function with the following parameters:

admin_move_table(
schemaname,
tablename,
destination_tablespace
)

Reply With Quote
  #2  
Old   
Gregor Kovac(
 
Posts: n/a

Default Re: Moving tables between tablespaces - 08-18-2008 , 06:17 AM






Hi!

Maybe this article an help you.
http://www.ibm.com/developerworks/db...dm-0602rielau/

Best regards,
Kovi

Troels Arvin pravi:
Quote:
Hello,

How does a use efficiently move a table between tablespaces, given that
the user doesn't have shell access to the server hosting the database?

Is there some built-in routine that the user can execute? - Such as a
function with the following parameters:

admin_move_table(
schemaname,
tablename,
destination_tablespace
)
--
____________________________
Quote:
http://kovica.blogspot.com|
-----------------------------~-~-~-~-~-~-~-~-~-~-
In A World Without Fences Who Needs Gates? |
Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-


Reply With Quote
  #3  
Old   
Gregor Kovac(
 
Posts: n/a

Default Re: Moving tables between tablespaces - 08-18-2008 , 06:17 AM



Hi!

Maybe this article an help you.
http://www.ibm.com/developerworks/db...dm-0602rielau/

Best regards,
Kovi

Troels Arvin pravi:
Quote:
Hello,

How does a use efficiently move a table between tablespaces, given that
the user doesn't have shell access to the server hosting the database?

Is there some built-in routine that the user can execute? - Such as a
function with the following parameters:

admin_move_table(
schemaname,
tablename,
destination_tablespace
)
--
____________________________
Quote:
http://kovica.blogspot.com|
-----------------------------~-~-~-~-~-~-~-~-~-~-
In A World Without Fences Who Needs Gates? |
Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-


Reply With Quote
  #4  
Old   
Serge Rielau
 
Posts: n/a

Default Re: Moving tables between tablespaces - 08-18-2008 , 06:29 AM



Troels Arvin wrote:
Quote:
Hello,

How does a use efficiently move a table between tablespaces, given that
the user doesn't have shell access to the server hosting the database?

Is there some built-in routine that the user can execute? - Such as a
function with the following parameters:

admin_move_table(
schemaname,
tablename,
destination_tablespace
)
There is no such thing in DB2 for LUW.
The easiest way is to do a CREATE TABLE LIKE followed by a LOAD from
CURSOR, a DROP and finally a RENAME TABLE.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab


Reply With Quote
  #5  
Old   
Serge Rielau
 
Posts: n/a

Default Re: Moving tables between tablespaces - 08-18-2008 , 06:29 AM



Troels Arvin wrote:
Quote:
Hello,

How does a use efficiently move a table between tablespaces, given that
the user doesn't have shell access to the server hosting the database?

Is there some built-in routine that the user can execute? - Such as a
function with the following parameters:

admin_move_table(
schemaname,
tablename,
destination_tablespace
)
There is no such thing in DB2 for LUW.
The easiest way is to do a CREATE TABLE LIKE followed by a LOAD from
CURSOR, a DROP and finally a RENAME TABLE.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab


Reply With Quote
  #6  
Old   
Troels Arvin
 
Posts: n/a

Default Re: Moving tables between tablespaces - 08-18-2008 , 06:42 AM



Serge Rielau wrote:
Quote:
admin_move_table(
schemaname,
tablename,
destination_tablespace
)

There is no such thing in DB2 for LUW.
:-(


Quote:
The easiest way is to do a CREATE TABLE LIKE followed by a LOAD from
CURSOR, a DROP and finally a RENAME TABLE.
Yes, that's also what I told the user to do. However, this will mean
losing indexes, constraints, permissions, and triggers as far as I can see.

--
Troels


Reply With Quote
  #7  
Old   
Troels Arvin
 
Posts: n/a

Default Re: Moving tables between tablespaces - 08-18-2008 , 06:42 AM



Serge Rielau wrote:
Quote:
admin_move_table(
schemaname,
tablename,
destination_tablespace
)

There is no such thing in DB2 for LUW.
:-(


Quote:
The easiest way is to do a CREATE TABLE LIKE followed by a LOAD from
CURSOR, a DROP and finally a RENAME TABLE.
Yes, that's also what I told the user to do. However, this will mean
losing indexes, constraints, permissions, and triggers as far as I can see.

--
Troels


Reply With Quote
  #8  
Old   
Serge Rielau
 
Posts: n/a

Default Re: Moving tables between tablespaces - 08-18-2008 , 07:50 AM



Troels Arvin wrote:
Quote:
Yes, that's also what I told the user to do. However, this will mean
losing indexes, constraints, permissions, and triggers as far as I can see.
You can check out the article Kovi pointed to.
It deals with these guys.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab


Reply With Quote
  #9  
Old   
Serge Rielau
 
Posts: n/a

Default Re: Moving tables between tablespaces - 08-18-2008 , 07:50 AM



Troels Arvin wrote:
Quote:
Yes, that's also what I told the user to do. However, this will mean
losing indexes, constraints, permissions, and triggers as far as I can see.
You can check out the article Kovi pointed to.
It deals with these guys.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab


Reply With Quote
  #10  
Old   
Mark A
 
Posts: n/a

Default Re: Moving tables between tablespaces - 08-18-2008 , 09:28 AM



"Serge Rielau" <srielau (AT) ca (DOT) ibm.com> wrote

Quote:
Troels Arvin wrote:
Yes, that's also what I told the user to do. However, this will mean
losing indexes, constraints, permissions, and triggers as far as I can
see.
You can check out the article Kovi pointed to.
It deals with these guys.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
I am a bit confused by the following statement in the article referenced:

"The composition of the DDL objects is entirely based on the documented
SYSCAT catalog views, with one exception. The high watermark for an IDENTITY
column needs to be retrieved from SYSIBM.SYSSEQUENCES.LASTASSIGNVAL, which
is not exposed in DB2 UDB V8."

Does COPYSCHEMA(<TARGETSCHEMA>,<TARGETTABLESPACEINFO>,< SOURCESCHEMA>) reset
the sequences and/or indentify columns to the same last assinged value as
the source schema? Does the COPYSCHEMA SP work differently in V9.5 versus
V8 in this regard?




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.