【脚本分享】表空间每天的使用情况

表空间近一个月的使用情况:

 

今天有网友问,如何查询近一个月的表空间使用情况:

select a.name, b.*
  from v$tablespace a,
       (select tablespace_id,
               trunc(to_date(rtime, 'mm/dd/yyyy hh24:mi:ss')) datetime,
               max(tablespace_usedsize * 8 / 1024) used_size
          from dba_hist_tbspc_space_usage
         where trunc(to_date(rtime, 'mm/dd/yyyy hh24:mi:ss')) >
               trunc(sysdate - 30) groupby tablespace_id,
         trunc(to_date(rtime, 'mm/dd/yyyy hh24:mi:ss')) orderby
         tablespace_id, trunc(to_date(rtime, 'mm/dd/yyyy hh24:mi:ss'))) b
 where a.ts# = b.tablespace_id


你可能感兴趣的:(脚本,表空间)