首页 > 学院 > 开发设计 > 正文

回收表空间的几个方法

2019-11-08 21:00:16
字体:
来源:转载
供稿:网友
回收表空间有以下几个方法:1. drop and recreate2.truncate  and restore with backup3. alter table move tablespace;alter index XXX rebuild ...4. exp/imp5 alter table XXX deallocate ...回收某个表使用空间的步骤:(1)、选择某个表空间中超过N个blocks的segments,通过此语句可以看出那个表占用的空间大。select segment_name,segment_type,blocks from dba_segments  where tablespace_name='TABLESPACENAME'  and blocks > N  order by blocks;(2)、分析表,得知表的一些信息analyze table TABLENAME estimate statistics; 执行完后再执行select initial_extent,next_extent,min_extents,blocks,empty_blocks from dba_tables  where table_name='TEST' and wner='AA';(3)、使用alter table ... deallocate unused 命令回收表的空间例如: alter table AA.TEST deallocate unused keep 1k;(4)、使用 alter tablespace TABLESPACENAME coalesce 命令回收表空间的空间。(5)、可以使用dba_free_space视图查看表空间中的空闲空间信息。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表