分享两个SQL,这两个SQL只是基础原型,大家自己自定义条件去做一些调整。主要是在前面讲过的dba_hist_active_sess_history相关sql上总结出来的比较实用的sql。
DBA_HIST_ACTIVE_SESS_HISTORY
DBA_HIST_ACTIVE_SESS_HISTORY displays the history of the contents of the in-memory active session history of recent system activity. This view contains snapshots of V$ACTIVE_SESSION_HISTORY. See "V$ACTIVE_SESSION_HISTORY" for further interpretation details for many of these columns (except SNAP_ID, DBID, and INSTANCE_NUMBER).
查看故障时间段等待事件、问题sql id及会话访问次数
- --alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
- select trunc(sample_time, 'mi') tm, sql_id, nvl(event,'CPU'),count(distinct session_id) cnt
- from dba_hist_active_sess_history
- where sample_time between to_date('2019-08-22 14:00:00') and
- to_date('2019-08-22 14:30:00')
- group by trunc(sample_time, 'mi'), sql_id,nvl(event,'CPU')
- order by cnt desc;
查看该sql相关的等待事件及对应的会话访问次数
- select sql_id, nvl(event, 'CPU'), count(distinct session_id) sz
- from dba_hist_active_sess_history a, dba_hist_snapshot b
- where sample_time between to_date('2019-08-22 14:00:00') and
- to_date('2019-08-22 15:00:00')
- and sql_id = '4ksvn2rgjnhcm'
- and a.snap_id = b.snap_id
- and a.instance_number = b.instance_number
- group by sql_id, nvl(event, 'CPU')
- order by sz desc;
问题描述 有一个学校的老师共用 N 个教室按照规定所有的钥匙都必须放在公共钥匙...
前言 复用,是一个重要的话题,也是我们日常开发中经常遇到的,不可避免的问题。...
复制代码 代码如下: % function GetBot() '查询蜘蛛 dim s_agent GetBot="" s_ag...
Cloudflare 有一项功能挺不错的,就是将页面上所有的邮箱地址都加密起来,防止机...
我们今天生活的数字时代在许多方面都是一个过剩的时代。互联网的爆炸违背了所有...
处理问题描述:现在我有个javaweb项目,需要在portal上面点击help即可打开“帮助...
1.1 格式框架 1.1.1 缩进 Python 语言采用严格的 “缩进” 来表明程序的格式框架...
其原理很简单,结构上基本不变,只是改变处理返回数据的方式. 1.Text/HTML格式 ...
前提 1. Cookie 是脆弱的。cookie 容易被窃取和受到垮站脚本的攻击,我们必须接...
最近做了一个资源库系统的项目,老师说可以搭建开源论坛替代自己开发社交模块,...