select to_char(snap.END_INTERVAL_TIME, 'yyyy-mm-dd hh24:mi:ss.ff'),
sum(tsu.TABLESPACE_SIZE * dt.BLOCK_SIZE) / (1024 * 1024 * 1024) total_gigabytes,
sum(tsu.TABLESPACE_USEDSIZE * dt.BLOCK_SIZE) / (1024 * 1024 * 1024) used_gigabytes
from DBA_HIST_TBSPC_SPACE_USAGE tsu,
DBA_HIST_SNAPSHOT snap,
V$TABLESPACE vt,
DBA_TABLESPACES dt
where tsu.SNAP_ID = snap.SNAP_ID
and tsu.DBID = snap.DBID
and snap.instance_number = 1
and tsu.TABLESPACE_ID = vt.TS#
and vt.NAME = dt.TABLESPACE_NAME
group by snap.END_INTERVAL_TIME
order by snap.END_INTERVAL_TIME;
下面是我的公众号:定期会更新一些Oracle 数据库及Python相关的学习经验。欢迎关注: