Oracle 数据库表空间碎片查询和整理

来源:互联网 发布:弹性刚度矩阵 编辑:程序博客网 时间:2024/06/08 15:22

dba_free_space 显示的是有free 空间的tablespace ,如果一个tablespace 的free 空间不连续,那每段free空间都会在dba_free_space中存在一条记录。如果一个tablespace 有好几条记录,说明表空间存在碎片,当采用字典管理的表空间碎片超过500就需要对表空间进行碎片整理。



select a.tablespace_name ,count(1) 碎片量 from

dba_free_space a, dba_tablespaces b

where a.tablespace_name =b.tablespace_name

and b.extent_management = 'DICTIONARY'

group by a.tablespace_name

having count(1) >20

order by 2;



表空间碎片整理语法:

alter tablespace users coalesce;
原创粉丝点击