查看ORACLE表空间大小
select a.tablespace_name 表空间名称,
100 - round((nvl(b.bytes_free, 0) / a.bytes_alloc) * 100, 2) 占用率,
round(a.bytes_alloc / 1024 / 1024, 2)/1024 容量GB,
round(nvl(b.bytes_free, 0) / 1024 / 1024, 2)/1024 空闲GB,
round((a.bytes_alloc - nvl(b.bytes_free, 0)) / 1024 / 1024, 2)/1024 使用GB,
to_char(sysdate, 'yyyy - mm - dd hh24 :mi :ss') 采样时间
from (select f.tablespace_name,
sum(f.bytes) bytes_alloc,
sum(decode(f.autoextensible, 'YES', f.maxbytes, 'NO', f.bytes)) maxbytes
from dba_data_files f
group by tablespace_name) a,
(select f.tablespace_name, sum(f.bytes) bytes_free
from sys.dba_free_space f
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name;