Skip to content

Instantly share code, notes, and snippets.

@danielAlbuquerque
Created March 27, 2017 12:42
Show Gist options
  • Save danielAlbuquerque/2d32ac43ea73fec2c9a6e7f180818307 to your computer and use it in GitHub Desktop.
Save danielAlbuquerque/2d32ac43ea73fec2c9a6e7f180818307 to your computer and use it in GitHub Desktop.
Free space in tablespaces
col "Tablespace" for a22
col "Used MB" for 99,999,999
col "Free MB" for 99,999,999
col "Total MB" for 99,999,999
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