文档地址:http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_3001.htm#i2192484
Description of the illustrationshrink_clause.gif
COMPACT
, then Oracle Database only defragments thesegment space and compacts the table rows for subsequent release.The database does not readjust the high water mark and does notrelease the space immediately. You must issue anotherALTER
TABLE
... SHRINK
SPACE
statement later to complete the operation. Thisclause is useful if you want to accomplish the shrink operation intwo shorter steps rather than one longer step.
ALTER
[INDEX
|TABLE
] ...SHRINK
SPACE
COMPACT
isequivalent to specifyingALTER
[INDEX
|TABLE
... COALESCE
. Theshrink_clause
can be cascaded(please refer to theCASCADE
clause, which follows)and compacts the segment more densely than does a coalesceoperation, which can improve performance. However, if you do notwant to release the unused space, then you can use the appropriateCOALESCE
clause.
CASCADE
, then Oracle Databaseperforms the same operations on all dependent objects oftable
,including secondary indexes on index-organizedtables.--如果指定CASCADE的话,数据库会在表的所有依赖的对象上执行相同的操作(即段的压缩工作,首先压缩段内的记录,即通过一些DML来进行数据重组;然后降低段的HWM水位线),包括索引组织表的二级索引。
Restrictions onthe shrink_clause Theshrink_clause
is subject to thefollowing restrictions:
-
You cannot specify this clause for a cluster, a clustered table,or any object with a
LONG
column. -
Segment shrink is not supported for tables with function-basedindexes or bitmap join indexes.
-
This clause does not shrink mapping tables of index-organizedtables, 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. Rowidmaterialized views must be rebuilt after the shrink operation.
补充:
从10g开始,oracle开始提供Shrink的命令,假如我们的表空间中支持自动段空间管理(ASSM),就可以使用这个特性缩小段,即降低HWM。