Log history

REM ################################################
REM # Creator: Vincent Fenoll
REM # Created: 2005/01/22
REM # Name: loghist.sql
REM  ################################################
REM #
REM # Compatible: Oracle 7 8i 9i 10g 11g
REM#
REM ################################################
REM #
REM # Switch logs history (archivelog on)
REM #
REM ################################################

SET ECHO OFF
BREAK on LOG_DATE SKIP 1
COMPUTE SUM LABEL TOTAL of SWITCHES on log_date
col LOG_HOUR format a12

select to_date(to_char(first_time,'DD-MM-YYYY'),'DD-MM-YYYY')       LOG_DATE,
to_char(first_time,'HH24')       LOG_HOUR,
count(*)                         SWITCHES
from v$loghist
group by to_date(to_char(first_time,'DD-MM-YYYY'),'DD-MM-YYYY'), to_char(first_time,'HH24')
order by 1,2
/
CLEAR BREAKS

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.