提取某一天内awr中的Time Model Statistics中统计值

2024-03-05 12:20

本文主要是介绍提取某一天内awr中的Time Model Statistics中统计值,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

分享一个sql脚本:
提取某一天内awr中的Time Model Statistics中统计值
(可以对比一天内,某个参数指标的变化)

set lines 200 pages 999;
col instance_number for 9 heading "I";
col date for a14;
col SQL_TIME      for 999.99 ;
col DB_CPU        for 999.99 ;
col PARSE_TIME    for 999.99 ;
col HARD_P_TIME   for 999.99 ;
col SEQ_LOAD_T    for 999.99 ;
col CONN_MA_CA_T  for 999.99 ;
col PLSQL_E_T     for 999.99 ;
col HARD_P_S_T    for 999.99 ;
col REP_B_T       for 999.99 ;
col HARD_P_M_T    for 999.99 ;
col PLSQL_comp_T  for 999.99 ;
col DB_TIME       for 9999.99;
col BK_E_TIME     for 999.99 ;
col BK_CPU_TIME   for 999.99 ;
with t_statd as (
select n.snap_id,n.instance_number,n.stat_name,(m.value-n.value)/1000000/60 del
from DBA_HIST_SYS_TIME_MODEL m ,DBA_HIST_SYS_TIME_MODEL n
where m.snap_id=n.snap_id+1
and m.snap_id>=(select min(snap_id) from (select snap_id from dba_hist_snapshot where to_char(begin_interval_time,'yyyymmdd')='&&date') )
and m.snap_id<=(select max(snap_id) from (select snap_id from dba_hist_snapshot where to_char(begin_interval_time,'yyyymmdd')='&&date') )
and m.INSTANCE_NUMBER=n.instance_number and m.stat_id=n.stat_id
and m.stat_name in ('sql execute elapsed time','DB CPU','parse time elapsed','hard parse elapsed time','sequence load elapsed time',
'connection management call elapsed time','PL/SQL execution elapsed time','hard parse (sharing criteria) elapsed time',
'repeated bind elapsed time','hard parse (bind mismatch) elapsed time','PL/SQL compilation elapsed time','DB time','background elapsed time','background cpu time'))
select to_char(a.END_INTERVAL_TIME,'mmdd HH24:MI:SS') "DATE",instance_number,
round((select del from t_statd where snap_id=a.snap_id and INSTANCE_NUMBER=a.instance_number and STAT_NAME='sql execute elapsed time' and rownum=1),2) "SQL_TIME",
round((select del from t_statd where snap_id=a.snap_id and INSTANCE_NUMBER=a.instance_number and STAT_NAME='DB CPU' and rownum=1),2) "DB_CPU",
round((select del from t_statd where snap_id=a.snap_id and INSTANCE_NUMBER=a.instance_number and STAT_NAME='parse time elapsed' and rownum=1),2) "PARSE_TIME",
round((select del from t_statd where snap_id=a.snap_id and INSTANCE_NUMBER=a.instance_number and STAT_NAME='hard parse elapsed time' and rownum=1),2) "HARD_P_TIME",
round((select del from t_statd where snap_id=a.snap_id and INSTANCE_NUMBER=a.instance_number and STAT_NAME='sequence load elapsed time' and rownum=1),2) "SEQ_LOAD_T",
round((select del from t_statd where snap_id=a.snap_id and INSTANCE_NUMBER=a.instance_number and STAT_NAME='connection management call elapsed time' and rownum=1),2) "CONN_MA_CA_T",
round((select del from t_statd where snap_id=a.snap_id and INSTANCE_NUMBER=a.instance_number and STAT_NAME='PL/SQL execution elapsed time' and rownum=1),2) "PLSQL_E_T",
round((select del from t_statd where snap_id=a.snap_id and INSTANCE_NUMBER=a.instance_number and STAT_NAME='hard parse (sharing criteria) elapsed time' and rownum=1),2) "HARD_P_S_T",
round((select del from t_statd where snap_id=a.snap_id and INSTANCE_NUMBER=a.instance_number and STAT_NAME='repeated bind elapsed time' and rownum=1),2) "REP_B_T",
round((select del from t_statd where snap_id=a.snap_id and INSTANCE_NUMBER=a.instance_number and STAT_NAME='hard parse (bind mismatch) elapsed time' and rownum=1),2) "HARD_P_M_T",
round((select del from t_statd where snap_id=a.snap_id and INSTANCE_NUMBER=a.instance_number and STAT_NAME='PL/SQL compilation elapsed time' and rownum=1),2) "PLSQL_comp_T",
round((select del from t_statd where snap_id=a.snap_id and INSTANCE_NUMBER=a.instance_number and STAT_NAME='DB time' and rownum=1),2) "DB_TIME",
round((select del from t_statd where snap_id=a.snap_id and INSTANCE_NUMBER=a.instance_number and STAT_NAME='background elapsed time' and rownum=1),2) "BK_E_TIME",
round((select del from t_statd where snap_id=a.snap_id and INSTANCE_NUMBER=a.instance_number and STAT_NAME='background cpu time' and rownum=1),2) "BK_CPU_TIME"
from (select * from (select END_INTERVAL_TIME,snap_id,instance_number,dbid from dba_hist_snapshot   where  to_char(END_INTERVAL_TIME,'yyyymmdd')='&&date' order by snap_id desc) where rownum<200) a
order by 2,1;
查询显示结果如下:(可以对比一天内,某个参数指标的变化 )
DATE            I SQL_TIME  DB_CPU PARSE_TIME HARD_P_TIME SEQ_LOAD_T CONN_MA_CA_T PLSQL_E_T HARD_P_S_T REP_B_T HARD_P_M_T PLSQL_comp_T  DB_TIME BK_E_TIME BK_CPU_TIME
-------------- -- -------- ------- ---------- ----------- ---------- ------------ --------- ---------- ------- ---------- ------------ -------- --------- -----------
1013 00:00:09   1   221.60   66.57       5.55         .22        .20          .11      1.93        .04     .00        .01          .02   252.94     34.46       17.60
1013 01:00:19   1   325.48   84.36      10.25         .10       1.40          .11       .01        .03     .01        .01          .00   388.76     55.44       24.55
1013 02:00:29   1   413.14   76.57       2.57         .09        .18          .10       .01        .02     .00        .00          .00   461.63     49.34       20.99
1013 03:00:39   1   457.44   90.92       2.78         .07        .92          .11       .01        .01     .01        .00          .01   522.45     60.79       25.83
1013 04:00:07   1   239.61   63.82       1.52         .14        .16          .10       .01        .02     .00        .00          .00   267.35     25.40       13.04
1013 05:00:16   1   467.21  106.59       4.10         .66       2.71          .10       .02        .02     .01        .01          .00   565.45     89.32       37.68
1013 06:00:10   1   313.15   76.91       2.38         .51        .76          .10       .02        .05     .01        .04          .01   351.57     36.65       17.12

gt

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30109892/viewspace-1813859/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/30109892/viewspace-1813859/

这篇关于提取某一天内awr中的Time Model Statistics中统计值的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/776492

相关文章

Pandas统计每行数据中的空值的方法示例

《Pandas统计每行数据中的空值的方法示例》处理缺失数据(NaN值)是一个非常常见的问题,本文主要介绍了Pandas统计每行数据中的空值的方法示例,具有一定的参考价值,感兴趣的可以了解一下... 目录什么是空值?为什么要统计空值?准备工作创建示例数据统计每行空值数量进一步分析www.chinasem.cn处

Python的time模块一些常用功能(各种与时间相关的函数)

《Python的time模块一些常用功能(各种与时间相关的函数)》Python的time模块提供了各种与时间相关的函数,包括获取当前时间、处理时间间隔、执行时间测量等,:本文主要介绍Python的... 目录1. 获取当前时间2. 时间格式化3. 延时执行4. 时间戳运算5. 计算代码执行时间6. 转换为指

使用Python从PPT文档中提取图片和图片信息(如坐标、宽度和高度等)

《使用Python从PPT文档中提取图片和图片信息(如坐标、宽度和高度等)》PPT是一种高效的信息展示工具,广泛应用于教育、商务和设计等多个领域,PPT文档中常常包含丰富的图片内容,这些图片不仅提升了... 目录一、引言二、环境与工具三、python 提取PPT背景图片3.1 提取幻灯片背景图片3.2 提取

Python实现word文档内容智能提取以及合成

《Python实现word文档内容智能提取以及合成》这篇文章主要为大家详细介绍了如何使用Python实现从10个左右的docx文档中抽取内容,再调整语言风格后生成新的文档,感兴趣的小伙伴可以了解一下... 目录核心思路技术路径实现步骤阶段一:准备工作阶段二:内容提取 (python 脚本)阶段三:语言风格调

一文详解如何在Python中从字符串中提取部分内容

《一文详解如何在Python中从字符串中提取部分内容》:本文主要介绍如何在Python中从字符串中提取部分内容的相关资料,包括使用正则表达式、Pyparsing库、AST(抽象语法树)、字符串操作... 目录前言解决方案方法一:使用正则表达式方法二:使用 Pyparsing方法三:使用 AST方法四:使用字

Mysql如何将数据按照年月分组的统计

《Mysql如何将数据按照年月分组的统计》:本文主要介绍Mysql如何将数据按照年月分组的统计方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录mysql将数据按照年月分组的统计要的效果方案总结Mysql将数据按照年月分组的统计要的效果方案① 使用 DA

Pydantic中model_validator的实现

《Pydantic中model_validator的实现》本文主要介绍了Pydantic中model_validator的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价... 目录引言基础知识创建 Pydantic 模型使用 model_validator 装饰器高级用法mo

详解C#如何提取PDF文档中的图片

《详解C#如何提取PDF文档中的图片》提取图片可以将这些图像资源进行单独保存,方便后续在不同的项目中使用,下面我们就来看看如何使用C#通过代码从PDF文档中提取图片吧... 当 PDF 文件中包含有价值的图片,如艺术画作、设计素材、报告图表等,提取图片可以将这些图像资源进行单独保存,方便后续在不同的项目中使

GORM中Model和Table的区别及使用

《GORM中Model和Table的区别及使用》Model和Table是两种与数据库表交互的核心方法,但它们的用途和行为存在著差异,本文主要介绍了GORM中Model和Table的区别及使用,具有一... 目录1. Model 的作用与特点1.1 核心用途1.2 行为特点1.3 示例China编程代码2. Tab

Python实现常用文本内容提取

《Python实现常用文本内容提取》在日常工作和学习中,我们经常需要从PDF、Word文档中提取文本,本文将介绍如何使用Python编写一个文本内容提取工具,有需要的小伙伴可以参考下... 目录一、引言二、文本内容提取的原理三、文本内容提取的设计四、文本内容提取的实现五、完整代码示例一、引言在日常工作和学