- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
3#
发表于 2012-6-26 19:55:26
action plan:
请运行以下脚本 并给出结果:- set lines 160 pages 1000 echo off feedback off
- col stat_name for a25
- col date_time for a40
- col BEGIN_INTERVAL_TIME for a20
- col END_INTERVAL_TIME for a20
- prompt "Enter the date in DD-Mon-YY Format and Stats you want to trend like 'redo size','physical reads','physical writes','session logical reads' etc."
- WITH sysstat AS
- (select sn.begin_interval_time begin_interval_time,
- sn.end_interval_time end_interval_time,
- ss.stat_name stat_name,
- ss.value e_value,
- lag(ss.value, 1) over(order by ss.snap_id) b_value
- from dba_hist_sysstat ss, dba_hist_snapshot sn
- where trunc(sn.begin_interval_time) >= sysdate-7
- and ss.snap_id = sn.snap_id
- and ss.dbid = sn.dbid
- and ss.instance_number = sn.instance_number
- and ss.dbid = (select dbid from v$database)
- and ss.instance_number = (select instance_number from v$instance)
- and ss.stat_name = 'redo size')
- select to_char(BEGIN_INTERVAL_TIME, 'mm/dd/yy_hh24_mi') || to_char(END_INTERVAL_TIME, '_hh24_mi') date_time,
- stat_name,
- round((e_value - nvl(b_value,0)) / (extract(day from(end_interval_time - begin_interval_time)) * 24 * 60 * 60
- + extract(hour from(end_interval_time - begin_interval_time)) * 60 * 60
- + extract(minute from(end_interval_time - begin_interval_time)) * 60 + extract(second from(end_interval_time - begin_interval_time))),0) per_sec
- from sysstat where(e_value - nvl(b_value,0)) > 0 and nvl(b_value,0) > 0
- /
复制代码 |
|