sql 显示过去8天的重做次数,按1小时的时间段分组
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 显示过去8天的重做次数,按1小时的时间段分组相关的知识,希望对你有一定的参考价值。
col 00 format a3
col 01 format a3
col 02 format a3
col 03 format a3
col 04 format a3
col 05 format a3
col 06 format a3
col 07 format a3
col 08 format a3
col 09 format a3
col 10 format a3
col 11 format a3
col 12 format a3
col 13 format a3
col 14 format a3
col 15 format a3
col 16 format a3
col 17 format a3
col 18 format a3
col 19 format a3
col 20 format a3
col 21 format a3
col 22 format a3
col 23 format a3
col Total format 999999
set line 200
select to_char(first_time,'MM/DD') as "Day",
decode(sum(decode(to_char(first_time, 'HH24'),'00',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'00',1,0))) as "00",
decode(sum(decode(to_char(first_time, 'HH24'),'01',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'01',1,0))) as "01",
decode(sum(decode(to_char(first_time, 'HH24'),'02',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'02',1,0))) as "02",
decode(sum(decode(to_char(first_time, 'HH24'),'03',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'03',1,0))) as "03",
decode(sum(decode(to_char(first_time, 'HH24'),'04',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'04',1,0))) as "04",
decode(sum(decode(to_char(first_time, 'HH24'),'05',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'05',1,0))) as "05",
decode(sum(decode(to_char(first_time, 'HH24'),'06',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'06',1,0))) as "06",
decode(sum(decode(to_char(first_time, 'HH24'),'07',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'07',1,0))) as "07",
decode(sum(decode(to_char(first_time, 'HH24'),'08',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'08',1,0))) as "08",
decode(sum(decode(to_char(first_time, 'HH24'),'09',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'09',1,0))) as "09",
decode(sum(decode(to_char(first_time, 'HH24'),'10',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'10',1,0))) as "10",
decode(sum(decode(to_char(first_time, 'HH24'),'11',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'11',1,0))) as "11",
decode(sum(decode(to_char(first_time, 'HH24'),'12',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'12',1,0))) as "12",
decode(sum(decode(to_char(first_time, 'HH24'),'13',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'13',1,0))) as "13",
decode(sum(decode(to_char(first_time, 'HH24'),'14',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'14',1,0))) as "14",
decode(sum(decode(to_char(first_time, 'HH24'),'15',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'15',1,0))) as "15",
decode(sum(decode(to_char(first_time, 'HH24'),'16',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'16',1,0))) as "16",
decode(sum(decode(to_char(first_time, 'HH24'),'17',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'17',1,0))) as "17",
decode(sum(decode(to_char(first_time, 'HH24'),'18',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'18',1,0))) as "18",
decode(sum(decode(to_char(first_time, 'HH24'),'19',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'19',1,0))) as "19",
decode(sum(decode(to_char(first_time, 'HH24'),'20',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'20',1,0))) as "20",
decode(sum(decode(to_char(first_time, 'HH24'),'21',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'21',1,0))) as "21",
decode(sum(decode(to_char(first_time, 'HH24'),'22',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'22',1,0))) as "22",
decode(sum(decode(to_char(first_time, 'HH24'),'23',1,0)),0,'-',sum(decode(to_char(first_time, 'HH24'),'23',1,0))) as "23",
count(*) as "Total"
from v$log_history
where first_time between sysdate-8 and sysdate
group by thread#, to_char(first_time,'MM/DD')
order by thread#, to_char(first_time,'MM/DD')
;
以上是关于sql 显示过去8天的重做次数,按1小时的时间段分组的主要内容,如果未能解决你的问题,请参考以下文章
Oracle SQL 语句:查看 redo log 每小时切换次数
Oracle SQL 语句:查看 redo log 每小时切换次数