SQL> create table t1 as select * from dba_objects;
表已创建。
SQL> create table t2 as select * from dba_objects;
表已创建。
SQL> create table t3 as select * from dba_objects;
表已创建。
查看表的大小 SQL> select t.bytes from user_segments t where t.segment_name=upper('t1')
2 /
BYTES
----------
6291456
或者 SQL> select sum(t.bytes) from user_extents t where t.segment_name=upper('t1');
SUM(T.BYTES)
------------
6291456
条件一:
The owner of a table or cluster, or a user with the DELETE ANY privilege, can
truncate the table or cluster with a TRUNCATE...DROP STORAGE statement.
表被截断。
SQL> select sum(t.bytes) from user_extents t where t.segment_name=upper('t1');
SUM(T.BYTES)
------------
65536
条件二
A database administrator ( DBA) can deallocate unused extents using the following
SQL syntax:
ALTER TABLE table_name DEALLOCATE UNUSED;
已删除49375行。
SQL> select sum(t.bytes) from user_extents t where t.segment_name=upper('t2');
SUM(T.BYTES)
------------
6291456
SQL> alter table t2 deallocate unused;
表已更改。
SQL> select sum(t.bytes) from user_extents t where t.segment_name=upper('t2');
SUM(T.BYTES)
------------
5767168
条件三:
表已更改。
SQL> alter table t2 shrink space;
表已更改。
SQL> select sum(t.bytes) from user_extents t where t.segment_name=upper('t2');
SUM(T.BYTES)
------------
65536
或者 SQL> select sum(t.bytes) from user_extents t where t.segment_name=upper('t3');
SUM(T.BYTES)
------------
6291456
SQL> alter table t3 move;
表已更改。
SQL> select sum(t.bytes) from user_extents t where t.segment_name=upper('t3');
SUM(T.BYTES)
------------
65536
条件四:
Periodically, Oracle deallocates one or more extents of a rollback segment if it has
the OPTIMAL size specified.
错误之处敬请指正
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10805681/viewspace-374261/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10805681/viewspace-374261/