Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3621862
  • 博文数量: 738
  • 博客积分: 1860
  • 博客等级: 上尉
  • 技术积分: 8006
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-07 08:51
个人简介

偶尔有空上来看看

文章分类

全部博文(738)

文章存档

2024年(24)

2023年(74)

2022年(134)

2021年(238)

2020年(115)

2019年(11)

2018年(9)

2017年(9)

2016年(17)

2015年(7)

2014年(4)

2013年(1)

2012年(11)

2011年(27)

2010年(35)

2009年(11)

2008年(11)

最近访客

分类: Oracle

2021-06-08 17:09:26


  1. -- sql 历史

  2. set lines 200
  3. set pages 1000
  4. col shijian for a13
  5. col execu_d for 999999
  6. col bg_d for 9999999999
  7. col dr_d for 9999999999
  8. col et_d for 99999999
  9. col ct_d for 99999999
  10. col io_time for 999999
  11. col clus_time for 999999
  12. col ap_time for 999999
  13. col cc_time for 999999
  14. col et_onetime for 999999

  15. select to_char(b.END_INTERVAL_TIME, 'yyyy-mm-dd hh24') shijian,
  16.        plan_hash_value,
  17.        round(sum(a.EXECUTIONS_DELTA),1) exec_cnt,
  18.        round(sum(a.BUFFER_GETS_DELTA),1) buffer_get,
  19.        round(sum(a.DISK_READS_DELTA),1) disk_read,
  20.        round(sum(a.ELAPSED_TIME_DELTA / 1000000),1) et_d,
  21.        round(sum(a.CPU_TIME_DELTA / 1000000),1) ct_d,
  22.        round(sum(IOWAIT_DELTA / 1000000),1) io_time,
  23.        round(sum(CLWAIT_DELTA / 1000000),1) clus_time,
  24.        round(sum(APWAIT_DELTA / 1000000),1) ap_time,
  25.        round(sum(ccwait_delta / 1000000),1) cc_time,
  26.        round(decode(sum(a.EXECUTIONS_DELTA), 0,
  27.               sum(a.BUFFER_GETS_DELTA),
  28.               round(sum(a.BUFFER_GETS_DELTA) / sum(a.EXECUTIONS_DELTA), 0)),1) get_onetime,
  29.        round(decode(sum(a.EXECUTIONS_DELTA), 0,
  30.               sum(a.rows_processed_delta),
  31.               round(sum(a.rows_processed_delta) / sum(a.EXECUTIONS_DELTA), 0)),1) rows_onetime,
  32.       round( decode(sum(a.EXECUTIONS_DELTA), 0,
  33.               sum(a.ELAPSED_TIME_DELTA / 1000),
  34.               round(sum(a.ELAPSED_TIME_DELTA / 1000) /
  35.                     sum(a.EXECUTIONS_DELTA), 0)),1) exec_ms
  36.   from dba_hist_sqlstat a, dba_hist_snapshot b
  37.  where a.SNAP_ID = b.SNAP_ID
  38.    and a.INSTANCE_NUMBER = b.INSTANCE_NUMBER
  39.    and a.sql_id = '&1'
  40.  group by to_char(b.END_INTERVAL_TIME, 'yyyy-mm-dd hh24'),plan_hash_value
  41.  order by 1,2;
展示一条sql执行的历史情况
阅读(12497) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~