首页 > 数据库 > Oracle > Oracle 回收站清理
Oracle 回收站清理
前几天,看到落落调优了一条由于回收站过大引起的 SQL 问题,作为一个 DBA 提供一些清理回收站的 SQL
-- 回收站大小
select sum (mb) from (
select * from (
select a.owner,a.OBJECT_NAME,a.ORIGINAL_NAME,b.bytes/ 1024 / 1024 MB
from dba_recyclebin a,dba_segments b where a.object_name=b.segment_name
order by MB desc ) ) ;
-- 回收站中对象的大小
select * from (
select a.owner,a.OBJECT_NAME,a.ORIGINAL_NAME,b.bytes/ 1024 / 1024 MB
from dba_recyclebin a,dba_segments b where a.object_name=b.segment_name
order by MB desc ) where rownum < 11 ;
-- 生成清理回收站 SQL
select * from ( select 'purge table ' ||a.owner|| '.' ||ORIGINAL_NAME|| ' ;'
from dba_segments b, dba_recyclebin a where a.object_name=b.segment_name order by b.bytes desc )
where rownum < 11 ;
-- 直接清理整个回收站
purge dba_recyclebin ;
-- 参考文献
落落调优 SQL
http://blog.csdn.net/robinson1988/article/details/9312913#comments
eygle Oracle10g 的回收站 (recyclebin) 和自由空间管理
http://www.eygle.com/archives/2006/08/recyclebin_and_free_space.html
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26442936/viewspace-769097/ ,如需转载,请注明出处,否则将追究法律责任。