------------------------------------------------------------------------
-----------------------------------查询数据库表空间---------------
-----------------------------------------------------------------------
select
upper(F.TABLESPACE_NAME) "表空间名",
D.TOT_GROOTTE_MB "表空间大小(M)",
ROUND(D.TOT_GROOTTE_MB - F.TOTAL_BYTES,1) "以实用表空间(M)",
ROUND(F.TOTAL_BYTES,1) "空闲表空间",
TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100,3),'990.99') "使用比"
FROM
(select TABLESPACE_NAME,ROUND(SUM(BYTES) / (1024 *1024),2) TOTAL_BYTES,ROUND(MAX(BYTES) / (1024 * 1024),2) MAX_BYTES FROM sys.dba_free_space group by TABLESPACE_NAME) F
,
(select DD.TABLESPACE_NAME,ROUND(SUM(DD.BYTES) / (1024 * 1024 ),2) TOT_GROOTTE_MB FROM SYS.DBA_DATA_FILES DD group by DD.TABLESPACE_NAME ) D
where D.TABLESPACE_NAME = F.TABLESPACE_NAME order by 5;
阅读(1705) | 评论(0) | 转发(0) |