获取活动会话最多的sample_time

2024年 7月 14日 40.7k 0

获取活动会话最多的sample_time

v$active_session_history视图去挖掘信息

set linesize 260 pagesize 1000

alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

select * from (

select inst_id,sample_time,sample_id,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 inst_id,sample_time,sample_id

         order by sample_time)

 

dba_hist_active_sess_history视图去挖掘信息

set linesize 260 pagesize 1000

alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

select * from (

select INSTANCE_NUMBER,sample_time,sample_id,count(*)

          from dba_hist_active_sess_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 instance_number in (select instance_number from v$instance)

         group by INSTANCE_NUMBER ,sample_time,sample_id

         order by sample_time)

相关文章

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

发布评论