Skip to content

Instantly share code, notes, and snippets.

@dieegorenan
Created March 22, 2018 16:59
Show Gist options
  • Save dieegorenan/28d84fb32803eed671ed6565e1544f8d to your computer and use it in GitHub Desktop.
Save dieegorenan/28d84fb32803eed671ed6565e1544f8d to your computer and use it in GitHub Desktop.
Verify the tablespace size.
SELECT df.tablespace_name AS "Tablespace",
totalusedspace AS "Used MB",
(df.totalspace - tu.totalusedspace) AS "Free MB",
df.totalspace AS "Total MB",
ROUND(100 * ( (df.totalspace - tu.totalusedspace)/ df.totalspace)) AS "% Free"
FROM (SELECT tablespace_name,
ROUND(SUM(bytes) / 1048576) totalspace
FROM dba_data_files
GROUP BY tablespace_name) df,
(SELECT ROUND(SUM(bytes) / 1048576) totalusedspace,
tablespace_name
FROM dba_segments
GROUP BY tablespace_name) tu
WHERE df.tablespace_name = tu.tablespace_name
AND df.totalspace <> 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment