1. 程式人生 > >ORA-10635: Invalid segment or tablespace type

ORA-10635: Invalid segment or tablespace type

space tables ecif 物化視圖 gem you opera idt column

上周星期天在遷移數據時,碰到了ORA-10635: Invalid segment or tablespace type 錯誤,當時的操作環境如下:

操作系統版本:

[[email protected] scripts]$ more /etc/issue
Red Hat Enterprise Linux ES release 4 (Nahant Update 6)

數據庫版本 :

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Release 10.2.0.4.0 - Production
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production

把一批表2011年的數據遷移到歷史表歸檔時,由於是DELETE操作,為了降低這批表的高水位線,執行下面操作。

ALTER TABLE TABLE_NAME ENABLE ROW MOVEMENT ;
ALTER TABLE TABLE_NAME SHRINK SPACE;

結果報如下錯誤:

技術分享

ORA-10635: Invalid segment or tablespace type

檢查這些表的表空間的EXTENT_MANAGEMETN的值,發現它是本地管理

SELECT TABLESPACE_NAME, EXTENT_MANAGEMENT FROM DBA_TABLESPACES WHERE TABLESPACE_NAME= ‘TABLESPACE_NAME‘

------------------------------------------------------------------------
xxxxxxx LOCAL

從10g開始,ORACLE開始提供Shrink的命令,假如我們的表空間中支持自動段空間管理 (ASSM),就可以使用這個特性縮小段,即降低HWM。這裏需要強調一點,10g的這個新特性,僅對ASSM表空間有效,否則會報 ORA-10635: Invalid segment or tablespace type。

其實會導致這個錯誤的原因還有其它一些:

1. You cannot specify this clause for a cluster, a clustered table, or any object with a LONG column.
2. Segment shrink is not supported for tables with function-based indexes or bitmap join indexes.
3. This clause does not shrink mapping tables of index-organized tables,even if you specify CASCADE.參見後面的測試
4. You cannot specify this clause for a compressed table.
5. You cannot shrink a table that is the master table of an ON COMMIT materialized view. Rowid materialized views must be rebuilt after the shrink operation.

1. 對cluster,cluster table,或具有Long類型列的對象不起作用。
2. 不支持具有function-based indexes 或 bitmap join indexes的表
3. 不支持mapping 表或index-organized表。
4. 不支持compressed 表

5: 不支持是ON COMMIT物化視圖中的主表

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

ORA-10635: Invalid segment or tablespace type