REM
REM DBAToolZ NOTE:
REM This script was obtained from DBAToolZ.com
REM It's configured to work with SQL Directory (SQLDIR).
REM SQLDIR is a utility that allows easy organization and
REM execution of SQL*Plus scripts using user-friendly menu.
REM Visit DBAToolZ.com for more details and free SQL scripts.
REM
REM
REM File:
REM s_log_hist_7.sql
REM
REM LOG
REM
REM Author:
REM Vitaliy Mogilevskiy
REM VMOGILEV
REM (www.dbatoolz.com)
REM
REM Purpose:
REM
REM This script will show history of threads for database
REM
REM
REM Usage:
REM s_log_hist_7.sql
REM
REM Example:
REM s_log_hist_7.sql
REM
REM
REM History:
REM 08-01-1998 VMOGILEV Created
REM
REM
set pages 999
break on date_sub skip 1
col number_of_threads heading 'Number Of|Threads'
col thread# heading 'Thread|Number'
col date_t format a20 heading 'Time Frame'
col date_sub heading 'Date'
compute sum of number_of_threads on date_sub
select substr(to_char(to_date(first_time,'MM/DD/YY HH24:MI:SS'),'Mon - DDth'),1,10) DATE_SUB
, to_char(to_date(first_time,'MM/DD/YY HH24:MI:SS'),'Mon - DDth HHam') DATE_T
, count(*) NUMBER_OF_THREADS
, thread#
FROM V$LOGHIST
GROUP BY substr(to_char(to_date(first_time,'MM/DD/YY HH24:MI:SS'),'Mon - DDth'),1,10)
, THREAD#
, to_char(to_date(first_time,'MM/DD/YY HH24:MI:SS'),'Mon - DDth HHam')
/