dbTalk Databases Forums  

Partitioned Table Question

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


Discuss Partitioned Table Question in the comp.databases.ibm-db2 forum.



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

Default Partitioned Table Question - 08-19-2011 , 03:57 PM






I've got a database with a large partitioned table where each
partition is in its own tablespace. We need to create a smaller test
version of this database where we don't need data from all the
partitions. I have a good full backup from this database, so I did a
"restore rebuild" including only the tablespaces I need. This worked
great. I then was able to detach the tablespaces with the good data
into their own tables.

What I wanted to do then was to drop the original table and recreate
it with a subset of the original partitions (attaching each partition
from the good tables I had managed to detach from the original
table).

So when I try to drop the original table, I get this error:

SQL0290N Table space access is not allowed. SQLSTATE=55039

Makes sense. So then I figure I'll just drop the tablespaces. Well,
that doesn't work either. I get this:

SQL0282N Table space "TEST" cannot be dropped because at least one of
the
tables in it, "TEST.T1", has one or more of its parts in another table
space. SQLSTATE=55024

If I try to detach those partitions, I get the same error as when I
try to drop the table. (Table space access is not allowed).

So, is there anyway to get rid of that table?

Thanks for any help.

Greig Wise

Reply With Quote
  #2  
Old   
MarkB
 
Posts: n/a

Default Re: Partitioned Table Question - 08-22-2011 , 12:41 AM






On Aug 20, 12:57*am, Greig <frital... (AT) gmail (DOT) com> wrote:
Quote:
I've got a database with a large partitioned table where each
partition is in its own tablespace. *We need to create a smaller test
version of this database where we don't need data from all the
partitions. *I have a good full backup from this database, so I did a
"restore rebuild" including only the tablespaces I need. *This worked
great. *I then was able to detach the tablespaces with the good data
into their own tables.

What I wanted to do then was to drop the original table and recreate
it with a subset of the original partitions (attaching each partition
from the good tables I had managed to detach from the original
table).

So when I try to drop the original table, I get this error:

SQL0290N *Table space access is not allowed. *SQLSTATE=55039

Makes sense. *So then I figure I'll just drop the tablespaces. *Well,
that doesn't work either. *I get this:

SQL0282N *Table space "TEST" cannot be dropped because at least one of
the
tables in it, "TEST.T1", has one or more of its parts in another table
space. *SQLSTATE=55024

If I try to detach those partitions, I get the same error as when I
try to drop the table. (Table space access is not allowed).

So, is there anyway to get rid of that table?

Thanks for any help.

Greig Wise
Hi Greig,

If you get SQL0290N you should check the state of your tablespaces.
What are the results of this query:

select tbsp_state, tbsp_name
from sysibmadm.snaptbsp_part
where tbsp_state<>'NORMAL'

Sincerely,
Mark B.

Reply With Quote
  #3  
Old   
Yonghang Wang
 
Posts: n/a

Default Re: Partitioned Table Question - 08-22-2011 , 09:11 AM



you may have your data/index on different tablespaces. try to drop them together.

db2 "drop tablespace a,b"

Reply With Quote
  #4  
Old   
Greig
 
Posts: n/a

Default Re: Partitioned Table Question - 08-23-2011 , 10:48 AM



On Aug 22, 10:11*am, Yonghang Wang <wyh... (AT) gmail (DOT) com> wrote:
Quote:
you may have your data/index on different tablespaces. *try to drop them together.

db2 "drop tablespace a,b"
This took care of it. I didn't know you could drop multiple
tablespaces at once. Thank you.

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.