【Oracle】查询每个用户下面剩余表空间

-- Oracle
SELECT 
	DBF.TABLESPACE_NAME,
	DBF.TOTALSPACE "总量(M)",
	DBF.TOTALBLOCKS 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)
posted @ 2024-09-29 15:48  K89  阅读(13)  评论(0编辑  收藏  举报