最近7天内 每天(某个)表空间的增长量
1col TS_NAME for a15 2SELECT a.snap_id, 3a.rtime, 4c.tablespace_name ts_name, 5round(a.tablespace_size * c.block_size / 1024 / 1024 / 1024, 2) TOTAL_SIZE_GB, 6round(a.tablespace_usedsize * c.block_size / 1024 / 1024 / 1024, 2) USED_SIZE_GB, 7round(a.tablespace_maxsize * c.block_size / 1024 / 1024 / 1024, 2) MAX_SIZE_GB, 8round((a.tablespace_size - a.tablespace_usedsize) * c.block_size / 1024 / 1024 / 1024, 2) FREE_SIZE_GB, 9round(a.tablespace_usedsize / a.tablespace_size * 100, 2) pct_used 10FROM dba_hist_tbspc_space_usage a, 11(SELECT tablespace_id, 12substr(rtime, 1, 10) rtime, 13max(snap_id) snap_id 14FROM dba_hist_tbspc_space_usage nb 15group by tablespace_id, substr(rtime, 1, 10)) b, 16dba_tablespaces c, 17v$tablespace d 18where a.snap_id = b.snap_id 19and a.tablespace_id = b.tablespace_id 20and a.tablespace_id = d.TS# 21and d.NAME = c.tablespace_name 22and d.NAME = 'USERS' 23and to_date(a.rtime, 'mm/dd/yyyy hh24:mi:ss') >= sysdate - 7 24order by a.tablespace_id, to_date(a.rtime, 'mm/dd/yyyy hh24:mi:ss') desc;
每个AWR快照间的(某个)表空间的增长量
1col TS_NAME for a15 2select distinct a.snap_id, 3a.rtime, 4d.NAME ts_name, 5round(a.tablespace_maxsize * c.block_size / 1024 / 1024 / 1024, 2) MAX_SIZE_GB, 6round(a.tablespace_size * c.block_size / 1024 / 1024 / 1024, 2) TOTAL_SIZE_GB, 7round(a.tablespace_usedsize * c.block_size / 1024 / 1024 / 1024, 2) USED_SIZE_GB, 8round((a.tablespace_size - a.tablespace_usedsize) * c.block_size / 1024 / 1024 / 1024, 2) FREE_SIZE_GB, 9round(a.tablespace_usedsize / a.tablespace_size * 100, 2) pct_used 10from DBA_HIST_TBSPC_SPACE_USAGE a, 11dba_hist_snapshot sn, 12dba_tablespaces c, 13V$TABLESPACE d 14where a.snap_id = sn.snap_id 15and d.TS# = a.TABLESPACE_ID 16and d.NAME = 'USERS' 17and sn.end_interval_time between to_timestamp('2019-12-01','YYYY-MM-DD') and to_timestamp('2019-12-02','YYYY-MM-DD') 18order by a.snap_id desc;
某个表空间下的对象在某个AWR快照之间的增长量
1-- DELTA_USED_SIZE_GB 已用空间的增长量 2select distinct a.snap_id, 3to_char(sn.BEGIN_INTERVAL_TIME, 'YYYY-MM-DD hh24:mi:ss') BEGIN_TIME, 4to_char(sn.END_INTERVAL_TIME, 'YYYY-MM-DD hh24:mi:ss') END_TIME, 5b.name TBS_NAME, 6c.owner, 7c.object_name, 8c.object_type, 9round(a.space_used_total / 1024 / 1024 / 1024, 2) TOTAL_USED_SIZE_GB, 10round(a.space_used_delta / 1024 / 1024 / 1024, 2) DELTA_USED_SIZE_GB 11from dba_hist_seg_stat a, 12dba_hist_snapshot sn, 13V$TABLESPACE b, 14dba_hist_seg_stat_obj c 15where a.snap_id = sn.snap_id 16and a.obj# = c.obj# 17and a.TS# = b.TS# 18and b.NAME = 'USERS' 19and a.snap_id between 17958 and 17959 20order by DELTA_USED_SIZE_GB desc,a.snap_id desc;
在特定时间段的AWR快照之间的数据库对象的增长量
1select obj.owner, obj.object_name,obj.OBJECT_TYPE,a.TS#, 2to_char(sn.BEGIN_INTERVAL_TIME, 'YYYY-MM-DD hh24:mi:ss') BEGIN_TIME, 3to_char(sn.END_INTERVAL_TIME, 'YYYY-MM-DD hh24:mi:ss') END_TIME, 4round(a.space_used_delta / 1024 / 1024 / 1024, 2) DELTA_USED_SIZE_GB 5from dba_hist_seg_stat a, 6dba_hist_snapshot sn, 7dba_objects obj 8where sn.snap_id = a.snap_id 9and obj.object_id = a.obj# 10and obj.owner not in ('SYS','SYSTEM') 11and end_interval_time between to_timestamp('01-12-2019','DD-MM-RRRR') and to_timestamp('02-12-2019','DD-MM-RRRR') 12order by DELTA_USED_SIZE_GB desc,obj.owner, obj.object_name
最近七天数据库的增长情况,这个只是一个估算值
1select sum(space_used_total) / 1024 / 1024 / 1024 "last 7 days db increase - G" 2from dba_hist_seg_stat s, dba_hist_seg_stat_obj o, dba_hist_snapshot sn 3where s.obj# = o.obj# 4and sn.snap_id = s.snap_id 5and begin_interval_time > sysdate - 8 6order by begin_interval_time
表空间暴涨原因核查
http://blog.itpub.net/28389881/viewspace-1301550/
查看表空间每天增长和每周增长情况
http://blog.itpub.net/24500180/viewspace-1062905/
一文看懂Oracle查询表空间的每日增长量和历史情况统计