cancel
Showing results for 
Search instead for 
Did you mean: 

How to move table to dbspace?

Former Member
4,243

What I am going to do is to create a dbspace that contains a table(s) that is existing in the main database file. Anyone know how to do it?

View Entire Topic
VolkerBarth
Contributor

AFAIK, there is no SQL Statement to "move" a table, so you will have to

  1. "copy the table" (i.e. create a new one in the desired dbspace and move the data from the existing one over, and delete the existing one afterwards), or
  2. use a "modified reload" to rebuild the whole database with the according table put on the desired dbspace - from the v12 docs:

Splitting existing databases

If you want to split existing database objects among multiple dbspaces, you must unload your database and modify the generated command file (named reload.sql by default) for rebuilding the database. In the reload.sql file, add IN clauses to the CREATE TABLE statements to specify the dbspace for each table you do not want to place in the main file.

If you would like to move the table in order to "free" the space of the system dbspace, then I guess method 2 is necessary, as a dbspace won't shrink without a rebuild.