vvsantos
1/8/2018 - 7:10 PM

Espaço livre #oracle #tablespace #consultas

Espaço livre #oracle #tablespace #consultas

select substr(TABLESPACE_NAME, 1, 40) tablespace,
       case
         when used_percent >= 95 then
          'Critico'
         when used_percent >= 75 then
          'Atenção'
         else
          'Normal'
       end alerta,
       -- % used        
       round(used_percent, 2) used_percent,
       tablespace_size tablespace_blocks,
       --used_space
       round((used_space * 8192) / (1024 * 1024), 2) used_mb,
       round(((used_space * 8192) / (1024 * 1024) / 1024), 2) used_gb,
       --TABLESPACE_SIZE
       round((tablespace_size * 8192) / (1024 * 1024), 2) tablespace_ext_mb,
       round(((tablespace_size * 8192) / (1024 * 1024) / 1024), 2) tablespace_ext_gb,
       round((((tablespace_size * 8192) / (1024 * 1024) / 1024) -
             ((used_space * 8192) / (1024 * 1024) / 1024)),
             2) restante_gb
  from dba_tablespace_usage_metrics x
 order by used_percent desc;