在工作中有时不能随时使用UI界面来管理或查看oracle的表空间,可通下面的sql脚本很容易了解表空间使用情况,不用做任何修改即可使用。
select f.tablespace_name,a.total,u.used,f.free,round((u.used/a.total)*100) "% used", round((f.free/a.total)*100) "% Free"
from
(select tablespace_name, sum(bytes/(1024*1024)) total
from dba_data_files group by tablespace_name) a,
(select tablespace_name, round(sum(bytes/(1024*1024))) used
from dba_extents group by tablespace_name) u,
(select tablespace_name, round(sum(bytes/(1024*1024))) free
from dba_free_space group by tablespace_name) f
WHERE a.tablespace_name = f.tablespace_name and a.tablespace_name = u.tablespace_name;
本文提供了一段SQL脚本,用于快速查询Oracle数据库中各表空间的使用情况,包括总大小、已用空间、剩余空间及百分比,无需任何配置即可直接使用。
256

被折叠的 条评论
为什么被折叠?



