分享两个实用SQL--查看故障时间等待事件、问题sql及会话访问次数

IT科技2025-11-05 05:55:2975518

分享两个SQL,分享这两个SQL只是实用数基础原型,大家自己自定义条件去做一些调整。看故主要是b2b信息网间等件问及在前面讲过的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;

云服务器提供商
本文地址:http://www.bhae.cn/html/05c20099794.html
版权声明

本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。

全站热门

用罗技G402玩英雄联盟——打造极致游戏体验(解密G402在英雄联盟中的优势与应用技巧)

用大白话告诉你小白都能看懂的Hadoop架构原理

用Python分析深圳程序员工资有多高?还真是多金的程序员!

过载保护+异构服务器的负载均衡,怎么设计?

Windows更新清理(优化系统性能和保护隐私的关键举措)

微服务架构有毒,何时不使用微服务?

4个需要避免的常见Kubernetes监控陷阱

小心踩雷!一个小小的正则表达式竟把CPU拖垮......

友情链接

滇ICP备2023000592号-9