oracle统计数据库增长量,Oracle 统计表空间和对象历史增长量

最近7天内 每天(某个)表空间的增长量

col TS_NAME for a15

SELECT a.snap_id,

a.rtime,

c.tablespace_name ts_name,

round(a.tablespace_size * c.block_size / 1024 / 1024 / 1024, 2) TOTAL_SIZE_GB,

round(a.tablespace_usedsize * c.block_size / 1024 / 1024 / 1024, 2) USED_SIZE_GB,

round(a.tablespace_maxsize * c.block_size / 1024 / 1024 / 1024, 2) MAX_SIZE_GB,

round((a.tablespace_size - a.tablespace_usedsize) * c.block_size / 1024 / 1024 / 1024, 2) FREE_SIZE_GB,

round(a.tablespace_usedsize / a.tablespace_size * 100, 2) pct_used

FROM dba_hist_tbspc_space_usage a,

(SELECT tablespace_id,

substr(rtime, 1, 10) rtime,

max(snap_id) snap_id

FROM dba_hist_tbspc_space_usage nb

group by tablespace_id, substr(rtime, 1, 10)) b,

dba_tablespaces c,

v$tablespace d

where a.snap_id = b.snap_id

and a.tablespace_id = b.tablespace_id

and a.tablespace_id = d.TS#

and d.NAME = c.tablespace_name

and d.NAME = 'USERS'

and to_date(a.rtime, 'mm/dd/yyyy hh24:mi:ss') >= sysdate - 7

order by a.tablespace_id, to_date(a.rtime, 'mm/dd/yyyy hh24:mi:ss') desc;

每个AWR快照间的(某个)表空间的增长量

col TS_NAME for a15

select distinct a.snap_id,

a.rtime,

d.NAME ts_name,

round(a.tablespace_maxsize * c.block_size / 1024 / 1024 / 1024, 2) MAX_SIZE_GB,

round(a.tablespace_size * c.block_size / 1024 / 1024 / 1024, 2) TOTAL_SIZE_GB,

round(a.tablespace_usedsize * c.block_size / 1024 / 1024 / 1024, 2) USED_SIZE_GB,

round((a.tablespace_size - a.tablespace_usedsize) * c.block_size / 1024 / 1024 / 1024, 2) FREE_SIZE_GB,

round(a.tablespace_usedsize / a.tablespace_size * 100, 2) pct_used

from DBA_HIST_TBSPC_SPACE_USAGE a,

dba_hist_snapshot sn,

dba_tablespaces c,

V$TABLESPACE d

where a.snap_id = sn.snap_id

and d.TS# = a.TABLESPACE_ID

and d.NAME = 'USERS'

and sn.end_interval_time between to_timestamp('2019-12-01','YYYY-MM-DD') and to_timestamp('2019-12-02','YYYY-MM-DD')

order by a.snap_id desc;

某个表空间下的对象在某个AWR快照之间的增长量

-- DELTA_USED_SIZE_GB 已用空间的增长量

select distinct a.snap_id,

to_char(sn.BEGIN_INTERVAL_TIME, 'YYYY-MM-DD hh24:mi:ss') BEGIN_TIME,

to_char(sn.END_INTERVAL_TIME, 'YYYY-MM-DD hh24:mi:ss') END_TIME,

b.name TBS_NAME,

c.owner,

c.object_name,

c.object_type,

round(a.space_used_total / 1024 / 1024 / 1024, 2) TOTAL_USED_SIZE_GB,

round(a.space_used_delta / 1024 / 1024 / 1024, 2) DELTA_USED_SIZE_GB

from dba_hist_seg_stat a,

dba_hist_snapshot sn,

V$TABLESPACE b,

dba_hist_seg_stat_obj c

where a.snap_id = sn.snap_id

and a.obj# = c.obj#

and a.TS# = b.TS#

and b.NAME = 'USERS'

and a.snap_id between 17958 and 17959

order by DELTA_USED_SIZE_GB desc,a.snap_id desc;

在特定时间段的AWR快照之间的数据库对象的增长量

select obj.owner, obj.object_name,obj.OBJECT_TYPE,a.TS#,

to_char(sn.BEGIN_INTERVAL_TIME, 'YYYY-MM-DD hh24:mi:ss') BEGIN_TIME,

to_char(sn.END_INTERVAL_TIME, 'YYYY-MM-DD hh24:mi:ss') END_TIME,

round(a.space_used_delta / 1024 / 1024 / 1024, 2) DELTA_USED_SIZE_GB

from dba_hist_seg_stat a,

dba_hist_snapshot sn,

dba_objects obj

where sn.snap_id = a.snap_id

and obj.object_id = a.obj#

and obj.owner not in ('SYS','SYSTEM')

and end_interval_time between to_timestamp('01-12-2019','DD-MM-RRRR') and to_timestamp('02-12-2019','DD-MM-RRRR')

order by DELTA_USED_SIZE_GB desc,obj.owner, obj.object_name

最近七天数据库的增长情况,这个只是一个估算值

select sum(space_used_total) / 1024 / 1024 / 1024 "last 7 days db increase - G"

from dba_hist_seg_stat s, dba_hist_seg_stat_obj o, dba_hist_snapshot sn

where s.obj# = o.obj#

and sn.snap_id = s.snap_id

and begin_interval_time > sysdate - 8

order by begin_interval_time

表空间暴涨原因核查

http://blog.itpub.net/28389881/viewspace-1301550/

查看表空间每天增长和每周增长情况

http://blog.itpub.net/24500180/viewspace-1062905/

一文看懂Oracle查询表空间的每日增长量和历史情况统计

http://www.solves.com.cn/it/sjk/Oracle/2019-10-14/6070.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值