SQL> create table tt nologging as select o.* from (select * from dba_objects where rownum<10001) o,(select * from dba_objects where rownum<101) o2 order by o.object_id;
SQL> select bytes/1024/1024 from user_segments where segment_name='TT';
BYTES/1024/1024
---------------
104
SQL> select count(*) from tt;
---------------
104
SQL> select count(*) from tt;
COUNT(*)
----------
1000000
SQL> delete from tt where mod(object_id,2)=0;
----------
1000000
SQL> delete from tt where mod(object_id,2)=0;
500200 rows deleted.
SQL> commit;
Commit complete.
SQL> select count(*) from tt;
COUNT(*)
----------
499800
----------
499800
SQL> alter table tt enable row movement;
Table altered.
SQL> select a.name,b.value from v$statname a,v$mystat b where a.statistic#=b.statistic# and a.name='redo size';
NAME VALUE
---------------------------------------------------------------- ----------
redo size 284458800
SQL> alter table tt shrink space;
---------------------------------------------------------------- ----------
redo size 284458800
SQL> alter table tt shrink space;
Table altered.
SQL> select a.name,b.value from v$statname a,v$mystat b where a.statistic#=b.statistic# and a.name='redo size';
NAME VALUE
---------------------------------------------------------------- ----------
redo size 477300696
---------------------------------------------------------------- ----------
redo size 477300696
SQL>
SQL>
SQL> select bytes/1024/1024 from user_segments where segment_name='TT';
SQL>
SQL> select bytes/1024/1024 from user_segments where segment_name='TT';
BYTES/1024/1024
---------------
46.0625
---------------
46.0625
转载于:https://blog.51cto.com/marvelyu/469203