Skip to content

Instantly share code, notes, and snippets.

@felclef
Created November 22, 2011 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felclef/1385671 to your computer and use it in GitHub Desktop.
Save felclef/1385671 to your computer and use it in GitHub Desktop.
Como obter o informações de tablespaces e seus tamanhos... SQL-zado de forma legível, não aquela m. de (+) etc
select
ts.tablespace_name as "Tablespace",
round(sum(df.bytes) / (1024*1024), 2) as "Total (MB)",
round(sum(df.bytes) / (1024*1024) - sum(fs.bytes) / (1024*1024), 2) as "Usado (MB)",
round(sum(fs.bytes) / (1024*1024), 2) as "Livre (MB)",
round(sum(fs.bytes) / sum(df.bytes) * 100, 4) as "Livre (%)",
100 - round(sum(fs.bytes) / sum(df.bytes) * 100, 4) as "Usado (%)"
from
dba_tablespaces ts
inner join dba_data_files df
on df.tablespace_name = ts.tablespace_name
inner join dba_free_space fs
on fs.tablespace_name = ts.tablespace_name
--where tablespace_name like 'GISACTP'
group by
ts.tablespace_name
order by
"Usado (%)" desc
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment