作者:守护雪天_使0062_423 | 来源:互联网 | 2014-07-08 01:11
Oracle查询表空间使用情况Sql代码selectf.tablespace_name,a.total,u.used,f.free,round((u.used/a.total)*100)"%used",www.2cto.comround((f.free/a.total)*100)"%Fre
Sql代码
select f.tablespace_name,a.total,u.used,f.free,round((u.used/a.total)*100 ) "% used", www.2cto.com
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;