求整理空间碎片压缩表命令

[复制链接]
查看11 | 回复9 | 2013-2-25 14:51:24 | 显示全部楼层 |阅读模式
生产库需要对表空间整理碎片,压缩表的命令。。
应该是分两部分吧
打开行移动,
再shrink
没有实际应用过。请各位大虾指教

回复

使用道具 举报

千问 | 2013-2-25 14:51:24 | 显示全部楼层
表空间中支持自动段空间管理 (ASSM)
alter table table_name enable row movement ;
alter table [table] shrink space;
回复

使用道具 举报

千问 | 2013-2-25 14:51:24 | 显示全部楼层
gyj_hobby 发表于 2012-12-12 09:20
表空间中支持自动段空间管理 (ASSM)
alter table table_name enable row movement ;
alter tableshrink ...

thanks!!
回复

使用道具 举报

千问 | 2013-2-25 14:51:24 | 显示全部楼层
不建议使用shrink
我们通常的做法是alter table move, rebuild indexes then gather statistics
回复

使用道具 举报

千问 | 2013-2-25 14:51:24 | 显示全部楼层
gyj_hobby 发表于 2012-12-12 09:20
表空间中支持自动段空间管理 (ASSM)
alter table table_name enable row movement ;
alter tableshrink ...

使用了,但是没有效果啊,求帮助
回复

使用道具 举报

千问 | 2013-2-25 14:51:24 | 显示全部楼层
myttsd 发表于 2012-12-12 10:20
不建议使用shrink
我们通常的做法是alter table move, rebuild indexes then gather statistics

表和索引都比较多,脚本操作耗时比较长啊
回复

使用道具 举报

千问 | 2013-2-25 14:51:24 | 显示全部楼层
yang358899140 发表于 2012-12-12 10:21
表和索引都比较多,脚本操作耗时比较长啊

这种方法更高效,但需要更多的空间。
回复

使用道具 举报

千问 | 2013-2-25 14:51:24 | 显示全部楼层
alter table table_name enable row movement ;
alter table [table] shrink space compact;(可以在压缩期间进行DML操作和查询,时间很长)
alter table [table] shrink space;(调整HWM时将阻塞DML操作,时间较短)

回复

使用道具 举报

千问 | 2013-2-25 14:51:24 | 显示全部楼层
用resize命令试试:
alter database datafile '/oradata/orcl/tp1.dbf' resize 100M;
回复

使用道具 举报

千问 | 2013-2-25 14:51:24 | 显示全部楼层
本帖最后由 yangrongyan2008 于 2012-12-12 10:28 编辑
语法:
alter table [table] shrink space [| compact | cascade ];
alter table [table] shrink space compcat; www.2cto.com
收缩表,相当于把块中数据打结实了,但会保持 high water mark;
alter table [table] shrink space;
收缩表,降低 high water mark;
alter table [table] shrink space cascade;
收缩表,降低 high water mark,并且相关索引也要收缩一下下。
alter index idxname shrink space;
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行