标签:
SELECT DBF.TABLESPACE_NAME,
DBF.TOTALSPACE "总量(M)",
DBF.TOTALBLOCKS AS 总块数,
DBF.TOTALSPACE-DFS.FREESPACE "使用量(M)",
DBF.TOTALBLOCKS-DFS.FREEBLOCKS AS 使用块数,
DFS.FREESPACE "剩余总量(M)",
DFS.FREEBLOCKS "剩余块数",
(DFS.FREESPACE / DBF.TOTALSPACE) * 100 "空闲比例"
FROM (SELECT T.TABLESPACE_NAME,
SUM(T.BYTES) / 1024 / 1024 TOTALSPACE,
SUM(T.BLOCKS) TOTALBLOCKS
FROM DBA_DATA_FILES T
GROUP BY T.TABLESPACE_NAME) DBF,
(SELECT TT.TABLESPACE_NAME,
SUM(TT.BYTES) / 1024 / 1024 FREESPACE,
SUM(TT.BLOCKS) FREEBLOCKS
FROM DBA_FREE_SPACE TT
GROUP BY TT.TABLESPACE_NAME) DFS
WHERE TRIM(DBF.TABLESPACE_NAME) = TRIM(DFS.TABLESPACE_NAME);
SELECT A.TABLESPACE_NAME,
A.BYTES/ 1024 / 1024 TOTAL,
B.BYTES/ 1024 / 1024 USED,
C.BYTES/ 1024 / 1024 FREE,
(B.BYTES * 100) / A.BYTES "% USED ",
(C.BYTES * 100) / A.BYTES "% FREE "
FROM SYS.SM$TS_AVAIL A, SYS.SM$TS_USED B, SYS.SM$TS_FREE C
WHERE A.TABLESPACE_NAME = B.TABLESPACE_NAME
AND A.TABLESPACE_NAME = C.TABLESPACE_NAME;
SELECT Total.name "Tablespace Name",
Free_space,
(total_space - Free_space) Used_space,
total_space
FROM (select tablespace_name, sum(bytes / 1024 / 1024) Free_Space
from sys.dba_free_space
group by tablespace_name) Free,
Oracle查看表空间使用率
标签:
原文地址:http://www.cnblogs.com/longjshz/p/4539693.html