[20240309]建立完善fms.sql与dfms.sql脚本.txt --//自己写一个脚本先收集force_matching_signature相同,sql_id不同的信息. $ cat fms.sql -- Copyright 2023 lfree. All rights reserved. -- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms and conditions. -------------------------------------------------------------------------------- -- -- File name: fms.sql v1.0 -- Purpose: Query gv$active_session_history Force_Matching_Signature the same, sql_id different of information -- Author: lfree -- -- Usage: -- @ fms <count(*)_number> <display_record_number> <fromtime> <totime> -- <count(*)_number>=2> -- -- Example: -- @ fms 5 30 &day -- -- Other: -- This script uses only the in-memory GV$ACTIVE_SESSION_HISTORY, use -- @dfms.sql for accessiong the DBA_HIST_ACTIVE_SESS_HISTORY archive -- -------------------------------------------------------------------------------- WITH a1 AS (SELECT sql_id,force_matching_signature, count(*) cnt1 FROM gv$active_session_history WHERE force_matching_signature <> 0 AND sample_time BETWEEN &3 AND &4 GROUP BY sql_id, force_matching_signature ) , a2 AS (SELECT force_matching_signature, count(*) sql_id_count,sum(cnt1) total_seconds FROM a1 GROUP BY force_matching_signature HAVING count(*) >= &&1 ORDER BY 3 desc) SELECT force_matching_signature, sql_id_count,total_seconds FROM a2 WHERE rownum <= &2; $ cat dfms.sql -- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms and conditions. -------------------------------------------------------------------------------- -- -- File name: dfms.sql v1.0 -- Purpose: Query dba_hist_active_sess_history Force_Matching_Signature the same, sql_id different of information -- Author: lfree -- -- Usage: -- @ idfms <count(*)_number> <display_record_number> <fromtime> <totime> -- <count(*)__number>=2> -- -- Example: -- @ fms 5 30 &day -- -- Other: -- This script uses only the DBA_HIST_ACTIVE_SESS_HISTORY -- @ fms.sql for accessiong the in-memory GV$ACTIVE_SESSION_HISTORY -- -------------------------------------------------------------------------------- WITH a1 AS (SELECT sql_id,force_matching_signature, count(*) cnt1 FROM dba_hist_active_sess_history WHERE force_matching_signature <> 0 AND sample_time BETWEEN &3 AND &4 and dbid = (SELECT d.dbid FROM v$database d) GROUP BY sql_id,force_matching_signature ) , a2 AS (SELECT force_matching_signature, count(*) sql_id_count,sum(cnt1)*10 total_seconds FROM a1 GROUP BY force_matching_signature HAVING count(*) >= &&1 ORDER BY 3 desc) SELECT force_matching_signature, sql_id_count,total_seconds FROM a2 WHERE rownum <= &2;
[20240309]建立完善fms.sql与dfms.sql脚本.txt
来源:这里教程网
时间:2026-03-03 19:40:00
作者:
编辑推荐:
下一篇:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- 数据库管理-第154期 Oracle Vector DB & AI-06(20240223)
- 某DG库磁盘IO性能问题之根因探究
某DG库磁盘IO性能问题之根因探究
26-03-03 - 豪华纯电第一股,迎来“繁花”开放
豪华纯电第一股,迎来“繁花”开放
26-03-03 - 欧菲斯冲刺IPO、齐心集团聚焦AI,数字化采购企业集体发力
欧菲斯冲刺IPO、齐心集团聚焦AI,数字化采购企业集体发力
26-03-03 - 从通用大模型到行业大模型,云厂商上演“宫斗剧”
从通用大模型到行业大模型,云厂商上演“宫斗剧”
26-03-03 - 吉时利Keithley2400数字源表
吉时利Keithley2400数字源表
26-03-03 - DG的三种应用机制
DG的三种应用机制
26-03-03 - 数据库管理-第153期 Oracle Vector DB & AI-05(20240221)
- 智能手机“卷向”AI
智能手机“卷向”AI
26-03-03 - 吉时利keithley2635B数字源表
吉时利keithley2635B数字源表
26-03-03
