Created
October 25, 2017 12:04
-
-
Save den-kozlov/7f6d4087c30ebb1d15271af30837566b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT df.tablespace_name "Tablespace" | |
, totalusedspace "Used MB" | |
, (df.totalspace - tu.totalusedspace) "Free MB" | |
, df.totalspace "Total MB" | |
, ROUND(100 * ((df.totalspace - tu.totalusedspace) / df.totalspace)) "Pct. Free" | |
FROM (SELECT tablespace_name, ROUND(SUM(bytes) / 1048576) TotalSpace | |
FROM dba_data_files | |
GROUP BY tablespace_name) df | |
, (SELECT ROUND(SUM(bytes) / (1024 * 1024)) totalusedspace, tablespace_name | |
FROM dba_segments | |
GROUP BY tablespace_name) tu | |
WHERE df.tablespace_name = tu.tablespace_name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment