Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.