sample_time分组活动会话趋势

sample_time分组活动会话趋势

分钟级别的活动会话分布

set linesize 260 pagesize 1000

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

select trunc(sample_time,'mi'),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 trunc(sample_time,'mi')

         order by trunc(sample_time,'mi');

 

秒级别的活动会话分布

set linesize 260 pagesize 1000

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

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

         order by sample_time,sample_id;