Thursday 7 May 2015

ORA-10635: Invalid segment or tablespace type problem resolution

Normally if you are trying to shrink a compressed table lets say you get below error, and the trick to solve it is below :-

For partition tables and for normal tables

alter table table_name modify partition  part_name shrink space ;
*
ERROR at line 1:
ORA-10635: Invalid segment or tablespace type

SQL> alter table <table_name> enable row movement;
Table altered.

SQL> alter table <table_name> shrink space compact;
alter table <table_name> shrink space compact
*
ERROR at line 1:
ORA-10635: Invalid segment or tablespace type

There are two possibilities:

(a) The SHRINK clause is not valid on a compressed table and you will get ORA-10635 .

(a) In case of a table being compressed table, can resolve issue like this:

sql> conn / as sysdba
sql> alter table <table_name> nocompress;
sql> alter table <table_name> enable row movement;
sql> alter table <table_name> shrink space compact;
sql> exit

(b) Autosegment space management was not set for the tablespace. Shrink operations can be performed only on segments in locally managed tablespaces with automatic segment space management (ASSM). Within an ASSM tablespace, all segment types are eligible for online segment shrink except these:
* IOT mapping tables
* Tables with rowid based materialized views
* Tables with function-based indexes.

b) In case autosegment space management is not set for the tablespace, please enable it. The way to “convert” to ASSM is to export all the objects from the MSSM tablespace, then create a new ASSM tablespace and finally import in this new one all the objects.

No comments:

Post a Comment