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

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 / 1024) USED_G
from dba_hist_tbspc_space_usage
where trunc(to_date(rtime, 'mm/dd/yyyy hh24:mi:ss')) >
trunc(sysdate - 30)
group by tablespace_id,
trunc(to_date(rtime, 'mm/dd/yyyy hh24:mi:ss'))
order by tablespace_id,
trunc(to_date(rtime, 'mm/dd/yyyy hh24:mi:ss'))) b
where a.ts# = b.tablespace_id
and a.NAME = 'AI_DATA'

select a.name, b.*
from v$tablespace a,
(select tablespace_id,
trunc(to_date(rtime, 'mm/dd/yyyy hh24:mi:ss')) datetime,
ROUND(max(tablespace_usedsize * 8 / 1024 / 1024), 2) USED_G
from dba_hist_tbspc_space_usage
where trunc(to_date(rtime, 'mm/dd/yyyy hh24:mi:ss')) >
trunc(sysdate - 30)
group by tablespace_id,
trunc(to_date(rtime, 'mm/dd/yyyy hh24:mi:ss'))
order by tablespace_id,
trunc(to_date(rtime, 'mm/dd/yyyy hh24:mi:ss'))) b
where a.ts# = b.tablespace_id
and a.NAME = 'CM_IDX'

原文地址:https://www.cnblogs.com/ss-33/p/10579571.html