获取活动会话最多的sample_time

获取活动会话最多的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)