采样某瞬时SAMPLE_TIME或者某时间段内SAMPLE_TIME

2024年 7月 15日 34.9k 0

采样某瞬时SAMPLE_TIME或者某时间段内SAMPLE_TIME

 

1.采样某瞬时SAMPLE_TIME的SQL_ID||SQL_PLAN_HASH_VALUE、EVENT的活动会话分组

 

某个sample_time时间点查看该sample_time时间点的等待事件和相关SQL_ID、p1、p2等参数

set linesize 260 pagesize 10000

select sql_id, nvl(event,'on cpu') event,count(*),p1||'',p2||''

  from v$active_session_history a

 where sample_id=&sample_id

 group by sql_id, nvl(event,'on cpu'),p1||'',p2||''

 order by count(*) desc;

 

某个sample_time时间点查看该sample_time时间点的等待事件和SQL_PLAN_HASH_VALUE、p1、p2等参数

set linesize 260 pagesize 10000

select SQL_PLAN_HASH_VALUE, nvl(event,'on cpu') event, count(*),p1||'',p2||''

  from v$active_session_history a

 where sample_id=&sample_id

 group by SQL_PLAN_HASH_VALUE, nvl(event,'on cpu'),p1||'',p2||''

 order by count(*) desc;

 

2.采样某时间段内SAMPLE_TIME的SQL_ID||SQL_PLAN_HASH_VALUE、EVENT的活动会话的分组

 

某时间段内等待事件和相关SQL_ID、p1、p2等参数

set linesize 260 pagesize 10000

col nvl(event,'ON CPU') for a40

select *

      from (select sql_id, nvl(event,'ON CPU'), count(*)

              from gv$active_session_history

             where sample_time between

                   to_date('&date1', 'yyyy-mm-dd hh24:mi:ss') and

                   to_date('&date2', 'yyyy-mm-dd hh24:mi:ss')

               and inst_id in (select instance_number from v$instance)

             group by sql_id, event

             order by count(*) desc)

    where rownum

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论