码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2015-09-05 23:42:34      阅读:359      评论:0      收藏:0      [点我收藏+]

标签:

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;

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

标签:

原文地址:http://www.cnblogs.com/hllnj2008/p/4784162.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!