dba_free_space 显示的是有free 空间的tablespace ,如果没有空闲(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;