【转自mos文章】使用单条sql来查询出awr中的syatem statistics

本文提供了一种通过单条SQL查询来监控来自自动工作负载存储库的最新系统统计信息的方法,包括重做大小、物理读取、物理写入等关键指标,并分析了每小时变化。

使用单条sql来查询出awr中的syatem statistics

参考自:
How to monitor system statistics from AWR snapshot by single SQL? (Doc ID 1320445.1)


适用于:
Oracle Server - Enterprise Edition - Version: 10.2.0.1 and later   [Release: 10.2 and later ]
Information in this document applies to any platform.

目标:
SQL to monitor the latest changes of system statistics gathered by Automatic Workload Repository.

The following statistics are included. 

'redo size'
'physical reads'
'physical writes'
'session logical reads'
'user calls',
'parse count (hard)'
'gcs messages sent'
'ges messages sent'
'gc cr blocks received'
'gc current blocks received'


解决方案:

This SQL outputs the average value (per hours) between the latest two AWR snapshots.



col STAT_NAME for a30
with snap_shot as
(
select  begin_time,SNAP_ID,rank from (
select trunc(BEGIN_INTERVAL_TIME,'MI') begin_time,SNAP_ID,rank() over (order by snap_id desc) as rank from DBA_HIST_SNAPSHOT
) where rank<3
),
new as
(select * from snap_shot where rank = 1),
old as
(select * from snap_shot where rank = 2)
select stat1.STAT_NAME,stat2.value-stat1.value value,(new.begin_time-old.begin_time)*24 duration_in_hour,
    (stat2.value-stat1.value)/((new.begin_time-old.begin_time)*24) value_per_hour
 from DBA_HIST_SYSSTAT stat1, DBA_HIST_SYSSTAT stat2,new,old
where stat1.snap_id=old.snap_id
  and stat2.snap_id=new.snap_id
  and stat1.STAT_NAME=stat2.STAT_NAME
  and stat1.STAT_NAME in ('redo size','physical reads','physical writes','session logical reads','user calls',
  'parse count (hard)','gcs messages sent','ges messages sent','gc cr blocks received','gc current blocks received')
  order by stat1.STAT_NAME;



 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sample Output:

SQL> col STAT_NAME for a30
SQL> with snap_shot as
  2  (
  3  select begin_time,SNAP_ID,rank from (
  4  select trunc(BEGIN_INTERVAL_TIME,'MI') begin_time,SNAP_ID,rank() over (order by snap_id desc) as rank from DBA_HIST_SNAPSHOT
  5  ) where rank<3
  6  ),
  7  new as
  8  (select * from snap_shot where rank = 1),
  9  old as
 10  (select * from snap_shot where rank = 2)
 11  select stat1.STAT_NAME,stat2.value-stat1.value value,(new.begin_time-old.begin_time)*24 duration_in_hour,
 12  (stat2.value-stat1.value)/((new.begin_time-old.begin_time)*24) value_per_hour
 13  from DBA_HIST_SYSSTAT stat1, DBA_HIST_SYSSTAT stat2,new,old
 14  where stat1.snap_id=old.snap_id
 15  and stat2.snap_id=new.snap_id
 16  and stat1.STAT_NAME=stat2.STAT_NAME
 17  and stat1.STAT_NAME in ('redo size','physical reads','physical writes','session logical reads','user calls',
 18  'parse count (hard)','gcs messages sent','ges messages sent','gc cr blocks received','gc current blocks received')
 19  order by stat1.STAT_NAME;

STAT_NAME                           VALUE DURATION_IN_HOUR VALUE_PER_HOUR
------------------------------ ---------- ---------------- --------------
gc cr blocks received                   0                1              0
gc current blocks received              0                1              0
gcs messages sent                       0                1              0
ges messages sent                       0                1              0
parse count (hard)                      0                1              0
physical reads                          7                1              7
physical writes                       377                1            377
redo size                          730992                1         730992
session logical reads               16159                1          16159
user calls                             38                1             38

10 rows selected.

SQL>



 


 

Security-feature-detection-system 安全检测系统 简介 安全检测系统-多目标识别(YOLOv5)和人脸识别(Facenet)快速部署系统。 功能上:本项目使用YOLOv5实现多目标识别,使用Facenet实现人脸识别,最终需要人脸和此人应具备的多目标同时满足才能通过安全检测,部署上:使用pyqt5实现前端可视化,在前端页面运行YOLOv5多目标识别系统(将模型运行封装到Qt中),使用Docker封装人脸识别后端系统,使用网络请求等包实现前后端交互 案例:进行多目标识别的同时,进行人脸识别,前端系统发送请求,携带参数到后端进行人脸识别,最终返回人脸识别结果,获取人脸识别结果后,检索该成员应具备的多目标特征,与YOLOv5多目标识别的实际结果进行比对,若无误则通过安全检测。 根据原作 https://pan.quark.cn/s/9784cdf4abfd 的源码改编 项目背景 于一些比赛的需要,以及逃离懵懂状态开始探索,我于2023.12~2024.1(大二上)开始一些CV、LLM项目的研究,苦于能力有限,当时大部分的项目都是依托开源搭建而来,诸如本项目就是依托开源的Compreface和Yolov5搭建,我只不过做了缝合的工作,所以在此必须提及这两个项目的巨大贡献:https://.com/exadel-inc/CompreFace https://.com/ultralytics/yolov5 今天是2024.7.11(大二下暑假),时隔半年我才开始这个项目的开源工作是因为,半年前的水平有限,虽然自己能实现项目的运作,但是恐很多细节介绍不好,当然本文自发,后续我还会跟进,欢迎指正:22012100039@stu.xidian.edu.c...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值