分类: Oracle
2010-12-02 11:26:40
测试:
SQL>conn / as sysdba
SQL>grant sysdba to hr
SQL>conn hr/passwd
--建立表,注意:其表空间的段管理方式为auto
SQL> create table tb_shrink_test as select * from dba_objects;
Table created.
--查看使用的块
SQL> select blocks from dba_segments where segment_name='TB_SHRINK_TEST' ;
BLOCKS
768
SQL> delete from tb_shrink_test;
50328 rows deleted.
SQL> commit;
Commit complete.
SQL> select blocks from dba_segments where segment_name='TB_SHRINK_TEST' ;
BLOCKS
768
--报错,使用收缩段,必须在该表上激活row movement
SQL> alter table tb_shrink_test shrink space;
alter table tb_shrink_test shrink space
*
ERROR at line 1:
ORA-10636: ROW MOVEMENT is not enabled
SQL> alter table tb_shrink_test enable row movement;
Table altered.
--try
SQL> alter table tb_shrink_test shrink space;
Table altered.
--再次查询blocks使用量
SQL> select blocks from dba_segments where segment_name='TB_SHRINK_TEST' ;
BLOCKS
8
---------end
补充,改表建立在example表空间上,segment未auto。如果是manual,
则会报错
SQL> alter table tb_manual shrink space
2 ;
alter table tb_manual shrink space
*
第 1 行出现错误:
ORA-10635: Invalid segment or tablespace type
SQL> select tablespace_name,segment_space_management from dba_tablespaces;
TABLESPACE_NAME SEGMEN
SYSTEM MANUAL
UNDOTBS1 MANUAL
SYSAUX AUTO
TEMP MANUAL
USERS AUTO
EXAMPLE AUTO
INDX AUTO
TS_AUTO AUTO
8 rows selected.
chinaunix网友2011-06-05 02:03:08
大连法律咨询在线 http://www.fabowang.com 大连律师在线咨询 http://www.fabowang.com 大连法律顾问网 http://www.fabowang.com 大连律师咨询 http://www.fabowang.com
chinaunix网友2010-12-05 15:13:51
很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com