- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
2#
发表于 2012-7-23 17:27:55
这样 extract AWR的意义不大, 你可以通过 10046 捕捉 awrrpt后台做了哪些查询, 列出部分示例:
SQL ordered by Elapsed Time- with sqt as
- (select elap, cput, exec, iowt, norm_val, sql_id, module, rnum
- from (select sql_id, module, elap, norm_val, cput, exec, iowt,
- rownum rnum
- from (select sql_id
- , max(module) module
- , sum(elapsed_time_delta) elap
- , (100 * (sum(elapsed_time_delta) /
- nullif(:dbtime,0))) norm_val
- , sum(cpu_time_delta) cput
- , sum(executions_delta) exec
- , sum(iowait_delta) iowt
- from dba_hist_sqlstat
- where dbid = :dbid
- and instance_number = :inst_num
- and :bid < snap_id
- and snap_id <= :eid
- group by sql_id
- order by nvl(sum(elapsed_time_delta), -1) desc, sql_id))
- where rnum < :tsql_max
- and (rnum <= :tsql_min or norm_val > :top_pct_sql))
- select /*+ NO_MERGE(sqt) */
- nvl((sqt.elap/1000000), to_number(null)),
- sqt.exec,
- decode(sqt.exec, 0, to_number(null),(sqt.elap / sqt.exec / 1000000)),
- sqt.norm_val,
- decode(sqt.elap, 0, to_number(null), (100 * (sqt.cput / sqt.elap))),
- decode(sqt.elap, 0, to_number(null), (100 * (sqt.iowt / sqt.elap))),
- sqt.sql_id,
- to_clob(decode(sqt.module, null,null, 'Module: ' || sqt.module)),
- nvl(st.sql_text,to_clob('** SQL Text Not Available **'))
- from sqt, dba_hist_sqltext st
- where st.sql_id(+) = sqt.sql_id and st.dbid(+) = :dbid
- order by sqt.rnum
复制代码 SQL ordered by CPU Time- with sqt as
- (select elap, cput, exec, uiot, norm_val, sql_id, module, rnum
- from (select sql_id, module, elap, norm_val, cput, exec, uiot,
- rownum rnum
- from (select sql_id
- , max(module) module
- , sum(elapsed_time_delta) elap
- , (100 * (sum(cpu_time_delta) /
- nullif(:tcpu,0))) norm_val
- , sum(cpu_time_delta) cput
- , sum(executions_delta) exec
- , sum(iowait_delta) uiot
- from dba_hist_sqlstat
- where dbid = :dbid
- and instance_number = :inst_num
- and :bid < snap_id
- and snap_id <= :eid
- group by sql_id
- order by nvl(sum(cpu_time_delta), -1) desc, sql_id))
- where rnum < :tsql_max
- and (rnum <= :tsql_min or norm_val > :top_pct_sql))
- select /*+ NO_MERGE(sqt) */
- nvl((sqt.cput/1000000), to_number(null)),
- sqt.exec,
- decode(sqt.exec, 0, to_number(null), (sqt.cput / sqt.exec /1000000)),
- sqt.norm_val,
- nvl((sqt.elap/1000000), to_number(null)),
- decode(sqt.elap, 0, to_number(null), (100 * (sqt.cput / sqt.elap))),
- decode(sqt.elap, 0, to_number(null), (100 * (sqt.uiot / sqt.elap))),
- sqt.sql_id,
- to_clob(decode(sqt.module, null,null, 'Module: ' || sqt.module)),
- nvl(st.sql_text,to_clob('** SQL Text Not Available **'))
- from sqt, dba_hist_sqltext st
- where st.sql_id(+) = sqt.sql_id and st.dbid(+) = :dbid
- order by sqt.rnum
复制代码 |
|