Thông tin dung lượng của Tablespace:
SELECT df.tablespace_name, df.total_space_mb, NVL(fs.free_space_mb, 0) AS free_space_mb, df.total_space_mb - NVL(fs.free_space_mb, 0) AS used_space_mb, ROUND(((df.total_space_mb - NVL(fs.free_space_mb, 0)) / df.total_space_mb) * 100, 2) AS pct_used FROM (SELECT tablespace_name, SUM(bytes) / 1024 / 1024 AS total_space_mb FROM dba_data_files GROUP BY tablespace_name) df LEFT JOIN (SELECT tablespace_name, SUM(bytes) / 1024 / 1024 AS free_space_mb FROM dba_free_space GROUP BY tablespace_name) fs ON df.tablespace_name = fs.tablespace_name ORDER BY pct_used DESC;