Skip to content

Instantly share code, notes, and snippets.

@dotmaik1
Last active October 6, 2016 16:17
Show Gist options
  • Select an option

  • Save dotmaik1/8812d6fd12c713fca78fd74a30a42e87 to your computer and use it in GitHub Desktop.

Select an option

Save dotmaik1/8812d6fd12c713fca78fd74a30a42e87 to your computer and use it in GitHub Desktop.
Tablespaces query for instant DBA
SELECT /* + RULE */ df.tablespace_name "Tablespace", df.bytes / (1024 * 1024) "Size (MB)", SUM(fs.bytes) / (1024 * 1024) "Free (MB)", Nvl(Round(SUM(fs.bytes) * 100 / df.bytes),1) "% Free", Round((df.bytes - SUM(fs.bytes)) * 100 / df.bytes) "% Used" FROM dba_free_space fs, (SELECT tablespace_name,SUM(bytes) bytes FROM dba_data_files GROUP BY tablespace_name) df WHERE fs.tablespace_name (+) = df.tablespace_name GROUP BY df.tablespace_name,df.bytes Order by 4;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment