当前位置:Gxlcms > 数据库问题 > Oracle 数据库表空间碎片查询和整理

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

时间:2021-07-01 10:21:17 帮助过:52人阅读

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 数据库表空间碎片查询和整理

标签:

人气教程排行