1.
表空间(或者临时表空间过大)
--
系统表空间 浪费资源怎么处理?
1.alter table 表名 shrink space;--表空间回收
此语句是删除某个表大量后用来回收该表空间--oracle 1
0g
上才支持的
2.alter tablespace TABLESPACENAME coalesce
此语句是整合表空间的碎片增加表空间的连续性,但是他不会收缩一个文件的
大小的。
3.
回收某个表使用空间的步骤:
(
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='HISHOLDSINFO' and owner='hs_his';
(
3
)、使用
alter table ... deallocate unused
命令回收表的空间
例如:
alter table hs_his.HISHOLDSINFO' deallocate unused keep 1k;
4.
将 表 空 间 用
compress=Y
参 数
exp
出 来 , 将 其 中 表
truncate
后 , 将 表
imp
进 去 。
5.
使 用
alter tablespace name coalesce;
手 动 收 缩 一 次 。
6.
将 表 空 间 的
pctincreace
参 改 为 大 于
0,
让 其 自 动 收 缩 。 一 般 改 为
1
。
alter tablespace name storage (pctincrease 1);
7. oracle
大表删除数据后,回收空间的问题。
在 oracle 中由于表结构设计不合理或者需要清楚老数据的时候,经常需要对
大表数据进行清理。
一般有一下几种方法:
1. 删除大部分数据,留下小部分数据。我们可以把需要保留的数据转移到别
的表,然后再把大表 drop 掉,然后改名就行了;
a) create table tablename_min as select * from tablename_max a where 需要
保留的数据.
b) drop table tablename_max ;
c) rename tablename_min as tablename_max ;
评论