Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

Display Oracle session volume per minute

Oracle Database Tips by Donald BurlesonApril 18,  2015

Ever need to know the number of sessions per minute?  This information is critical for Oracle tuning because understanding the number of active sessions over time is invaluable for Oracle capacity planning.  This script below produces a listing of all active session per minute over time. 

For complete scripts for plotting Oracle metrics, see The Oracle script collection.

When plotted, a chart of sessions per minute reveals important insights into Oracle performance under stress.  This sessions per minute script uses the ASH table and the concept that dbtime (s) / duration (s) = active sessions per second:

 

 

SNAPTIME                 Duration (s) Avg Active Sessions/min

------------------------------ ------------ ----------------------

17-APR-09 04.00.37.726 AM        3601.452              5.87

17-APR-09 05.00.39.191 AM        3601.465              7.12

17-APR-09 06.00.40.660 AM        3601.469             14.31

17-APR-09 07.00.42.174 AM        3601.514             29.89

17-APR-09 08.00.43.830 AM        3601.656              42.2

17-APR-09 09.00.46.466 AM        3602.636             39.52

17-APR-09 10.00.49.354 AM        3602.888             36.28

17-APR-09 11.00.51.172 AM        3601.818             39.27

17-APR-09 12.00.54.496 PM        3603.324             39.33

17-APR-09 01.00.57.978 PM        3603.482             90.04

17-APR-09 02.00.01.009 PM        3543.031             45.39

 

 

STATSPACK - Oracle sessions per minute

 

This script uses the free STATSPACK tables to compute session activity:

set linesize 150

 

/*

Example Output:

 

SNAPTIME         Duration (s) Avg. Active Sessions/min

-------------------- ------------ ------------------------

19-APR-2009 05:00:05         3604               1.99

19-APR-2009 06:00:07         3602               2.46

19-APR-2009 07:00:04         3597               8.31

19-APR-2009 08:00:02         3598               2.03

19-APR-2009 09:00:01         3599               1.98

19-APR-2009 10:00:01         3600               1.98

19-APR-2009 11:00:00         3599                2.4

 

*/

 

with sessiondata as (

  select snaptime,

  snaptime - lag(snaptime) over (order by snaptime) duration,

  dbtime - lag(dbtime) over (order by snaptime) timedelta

  from (

    select s.snap_time snaptime,

    (select sum(time_waited_micro) / 1000000 from stats$system_event se where event not in (select event from stats$idle_Event)
see code depot for full script

      and se.snap_id = s.snap_id and se.dbid = s.dbid and se.instance_number = s.instance_number) +

    (ss.value / 100) dbtime

    from stats$snapshot s, stats$sysstat ss

    where s.snap_id = ss.snap_id and s.dbid = ss.dbid and s.instance_number = ss.instance_number

    and s.dbid = (select dbid from v$database)

    and s.instance_number = (select instance_number from v$instance)

    and ss.name = 'CPU used by this session'

    )

)

select to_char(snaptime, 'DD-MON-YYYY HH24:MI:SS') snaptime, duration * 86400 "Duration (s)",

round((timedelta / (duration * 86400)) * 60, 2) "Avg. Active Sessions/min"

from sessiondata

/

 

 

 

ASH - Sessions per minute

 

 This script uses ASH to determine sessions per minute, using dba_hist_active_session_history:

 

 

set linesize 150

column snaptime format a30

 

with sessiondata as (select snaptime, dbtime / 1000000 dbtime,

  (extract(day from duration) * 86400) +

  (extract(hour from duration) * 3600) +

  (extract(minute from duration) * 60) +

  extract(second from duration) duration

from (

select
  s.begin_interval_time snaptime, s.begin_interval_time - lag 
 (s.begin_interval_time) over (order by s.begin_interval_time) duration,

  tm.value - lag(tm.value) over (order by s.begin_interval_time) dbtime

from
   dba_hist_snapshot s,
   dba_hist_sys_time_model tm

see code depot for full script

where

   s.snap_id = tm.snap_id

and
   s.instance_number = tm.instance_number

and
   s.dbid = tm.dbid

and
   s.instance_number = (select instance_number from v$instance)

and
   s.dbid = (select dbid from v$database)

and
   tm.stat_name = 'DB time'

and
   s.snap_id between &beginsnap and &endsnap

))

select
   snaptime,
   duration "Duration (s)", round((dbtime / duration) * 60, 2) "Active Sessions/min"

from
   sessiondata

/

 


 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.