表領域使用率の監視

1106 ワード

一時表領域:
select *
  from (select a.tablespace_name, sum(a.bytes / 1024 / 1024) allocated_mb
          from dba_temp_files a
         where a.tablespace_name = upper('&&temp_tsname')
         group by a.tablespace_name) x,
       (select sum(b.bytes_used / 1024 / 1024) used_mb,
               sum(b.bytes_free / 1024 / 1024) free_mb
          from v$temp_space_header b
         where b.tablespace_name = upper('&&temp_tsname')
         group by b.tablespace_name);

永続的な表領域:
select a.tablespace_name "    ",
       round(total / 1024 / 1024, 2)      ,
       round(free / 1024 / 1024, 2)        ,
       round((total - free) / 1024 / 1024, 2)        ,
       round((total - free) / total, 4) * 100 "    %"
  from (select tablespace_name, sum(bytes) free
          from dba_free_space
         group by tablespace_name) a,
       (select tablespace_name, sum(bytes) total
          from dba_data_files
         group by tablespace_name) b
 where a.tablespace_name = b.tablespace_name;