ORA-10631: SHRINK clause should not be specified for this object(原因)

张维照 2019-05-31
20
0 0
摘要:I’ve been shrinking objects to reclaim space that is not needed. Today I was shrinking some tables and ran into the error ORA-10631.

问题描述

I’ve been shrinking objects to reclaim space that is not needed. Today I was shrinking some tables and ran into the error ORA-10631.

PROBLEM:

ORA-10631:SHRINK clause should not be specified for this object SOLUTION:
SQL> alter table mytest shrink space;
alter table mytest shrink space
*
ERROR at line 1:
ORA-10631: SHRINK clause should not be specified for this object


专家解答

Shrink operations can be performed only on segments in locally managed tablespaces with automatic segment space management (ASSM). Within an ASSM tablespace. Restrictions on the shrink_clause. The shrink_clause is subject to the following restrictions:

* You cannot specify this clause for a cluster, a clustered table, or any object with a LONG column.
* This clause does not shrink mapping tables of index-organized tables, even if you specify CASCADE.
* You cannot specify this clause for a compressed table.
* 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. 
* You cannt spefify this clause for a table that contains a Text index, indextype is ctxsys.context
* Segment shrink is not supported for tables with function-based indexes, domain indexes, or bitmap join indexes.

This script I’ve provided is script to help you identify what and where the “function-based” indexes are. Use at your own discretion.

  SELECT dt.owner,
         dt.table_name,
         (CASE WHEN NVL (ind.cnt, 0) < 1 THEN 'Y' ELSE 'N' END) AS can_shrink
    FROM dba_tables dt,
         (  SELECT table_name, COUNT (*) cnt
              FROM dba_indexes di
             WHERE index_type LIKE 'FUNCTION-BASED%'
          GROUP BY table_name) ind
   WHERE     dt.table_name = ind.table_name(+)
         AND dt.table_name NOT LIKE 'AQ$%'
         AND dt.table_name NOT LIKE 'BIN$%'
         AND dt.owner = '&ownername'
ORDER BY 1, 2;


「喜欢文章,快来给作者赞赏墨值吧」

评论

0
0
Oracle
订阅
欢迎订阅Oracle频道,订阅之后可以获取最新资讯和更新通知。
墨值排行
今日本周综合
近期活动
全部
相关课程
全部