詳細顯示資料表空間的使用率與剩餘空間的SQL

ljm0211發表於2012-07-02
SELECT d.tablespace_name, SPACE sum_space,
SPACE - NVL (free_space, 0) used_space,
ROUND ((1 - NVL (free_space, 0) / SPACE) * 100, 2) used_rate,
free_space free_space
FROM (SELECT   tablespace_name, ROUND (SUM (BYTES) / (1024 * 1024),
2) SPACE, SUM (blocks) blocks
FROM dba_data_files
GROUP BY tablespace_name) d,
(SELECT   tablespace_name,
ROUND (SUM (BYTES) / (1024 * 1024), 2) free_space
FROM dba_free_space
GROUP BY tablespace_name) f
WHERE d.tablespace_name = f.tablespace_name(+);

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/11411056/viewspace-734300/,如需轉載,請註明出處,否則將追究法律責任。

相關文章