Purpose
You can use this statement to rewrite the data of a table.
Syntax
ALTER TABLE table_name SHRINK SPACE
Parameters
| Parameter | Description |
|---|---|
| table_name | The name of the table. |
Examples
Create the
employeetable and insert data.obclient> CREATE TABLE employee (id NUMBER, name VARCHAR2(50)); obclient> INSERT INTO employee VALUES (1, 'John'); obclient> INSERT INTO employee VALUES (2, 'Mary');Rewrite (shrink) the data in the
employeetable.obclient> ALTER TABLE employee SHRINK SPACE;Verify the result of the space shrink operation.
obclient> SELECT segment_name, bytes/1024/1024 MB FROM user_segments WHERE segment_name = 'EMPLOYEE';