暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

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

张维照 2019-05-31
3120

问题描述

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;


「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论