用如下语句查看:
select a.tablespace_name,a.bytes/1024/1024 "Sum MB",(a.bytes-b.bytes)/1024/1024 "used MB",b.bytes/1024/1024 "free MB",round(((a.bytes-b.bytes)/a.bytes)*100,2) "percent_used"
from
(select tablespace_name,sum(bytes) bytes from dba_data_files group by tablespace_name) a,
(select tablespace_name,sum(bytes) bytes,max(bytes) largest from dba_free_space group by tablespace_name) b
where a.tablespace_name=b.tablespace_name
order by ((a.bytes-b.bytes)/a.bytes) desc
查询结果:
其中红框部分即为空闲内存的显示结果。
你是想问表空间中的剩余量吧?可以使用以下sql:
select a.tablespace_name,a.free_space,b.total_space, a.free_space/b.total_space free_ratio
from
(select tablespace_name,sum(bytes)/1024/1024 free_space from dba_free_space group by tablespace_name) a,
(select tablespace_name,sum(bytes)/1024/1024 total_space from dba_data_files group by tablespace_name) b
where a.tablespace_name=b.tablespace_name;
这样就能看出每个表空间(tablespace_name)的空闲量(free_space)、总量(total_space)和空闲率(free_ratio)当然了你也可以把这个语句建成视图,以后就不用老是复制粘贴了。