Query Varie

Da Emigar.
Versione del 12 mag 2010 alle 17:17 di WikiSysop (discussione | contributi)
(diff) ← Versione meno recente | Versione attuale (diff) | Versione più recente → (diff)
Jump to navigation Jump to search

Controllo Allocazione Spazio

Questa query controlla lo spazio allocato, e lo confronta con lo spazio di massima crescita dei datafiles. Utile per evidenziare casi in cui è necessario aggiungere altri datafiles.

select TBS.MB_MAX,
       TBS.MB_TBS,
       SEG.MB_SEG,
       TBS.MB_MAX-SEG.MB_SEG MB_FREE,
       TBS.TABLESPACE_NAME
  from (select round(sum(f.maxbytes)/(1024*1024)) MB_MAX,
               round(sum(f.user_bytes)/(1024*1024)) MB_TBS,
               f.tablespace_name TABLESPACE_NAME
          from dba_data_files f
         group by f.tablespace_name) TBS,
       (select round(sum(s.bytes)/(1024*1024)) MB_SEG,
               s.tablespace_name TABLESPACE_NAME
          from dba_segments s
         group by s.tablespace_name) SEG
 where SEG.tablespace_name=TBS.tablespace_name;