Skip to content

Instantly share code, notes, and snippets.

@mattantonelli
Created July 8, 2014 14:28
Show Gist options
  • Save mattantonelli/612fcf4f483a9ba9c4ca to your computer and use it in GitHub Desktop.
Save mattantonelli/612fcf4f483a9ba9c4ca to your computer and use it in GitHub Desktop.
All datafiles of tablespaces that are more than 85% full
select df.tablespace_name "Tablespace",
df.file_name "File",
df.status "Status",
df.autoextensible "Auto Extend?",
round((df.bytes / 1073741824), 2) "Used GB",
round((df.maxbytes / 1073741824), 2) "Max GB",
round(100 * (df.bytes / df.maxbytes), 2) "% Used",
round((df.increment_by * (df.bytes / df.blocks)) / 1073741824, 2) "Extent Size GB",
round((df.maxbytes - df.bytes) / (df.increment_by * (df.bytes / df.blocks))) "Remaining Extensions",
round(pu."pct_used", 2) "% Tablespace Used"
from
(select tablespace_name,
100 * (sum(bytes) / sum(maxbytes)) "pct_used"
from dba_data_files
group by tablespace_name) pu,
(select tablespace_name,
file_name,
status,
autoextensible,
bytes,
maxbytes,
increment_by,
blocks
from dba_data_files) df
where (pu.tablespace_name = df.tablespace_name)
and (pu."pct_used" > 85)
order by 10 DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment