Skrypt do przedstawienia historii przełączeń redologów w kolejnych godzinach i dniach. Przydatna rzecz choćby do planowania strategii backupów lub jako przegląd aktywności bazy.
set cmds on
col date for a15; col total for 99999; col h00 for 999; col h01 for 999
col h02 for 999; col h03 for 999; col h04 for 999; col h05 for 999
col h06 for 999; col h07 for 999; col h08 for 999; col h09 for 999
col h10 for 999; col h11 for 999; col h12 for 999; col h13 for 999
col h14 for 999; col h15 for 999; col h16 for 999; col h17 for 999
col h18 for 999; col h19 for 999; col h20 for 999; col h21 for 999
col h22 for 999; col h23 for 999; col h24 for 999; col mb for 999,999
select to_char(first_time, 'yyyy-mm-dd Dy') "date",
sum(blocks*block_size)/1024/1024 "MB",
count(1) "total",
sum(decode(to_char(first_time, 'hh24'),'00',1,0)) "h00",
sum(decode(to_char(first_time, 'hh24'),'01',1,0)) "h01",
sum(decode(to_char(first_time, 'hh24'),'02',1,0)) "h02",
sum(decode(to_char(first_time, 'hh24'),'03',1,0)) "h03",
sum(decode(to_char(first_time, 'hh24'),'04',1,0)) "h04",
sum(decode(to_char(first_time, 'hh24'),'05',1,0)) "h05",
sum(decode(to_char(first_time, 'hh24'),'06',1,0)) "h06",
sum(decode(to_char(first_time, 'hh24'),'07',1,0)) "h07",
sum(decode(to_char(first_time, 'hh24'),'08',1,0)) "h08",
sum(decode(to_char(first_time, 'hh24'),'09',1,0)) "h09",
sum(decode(to_char(first_time, 'hh24'),'10',1,0)) "h10",
sum(decode(to_char(first_time, 'hh24'),'11',1,0)) "h11",
sum(decode(to_char(first_time, 'hh24'),'12',1,0)) "h12",
sum(decode(to_char(first_time, 'hh24'),'13',1,0)) "h13",
sum(decode(to_char(first_time, 'hh24'),'14',1,0)) "h14",
sum(decode(to_char(first_time, 'hh24'),'15',1,0)) "h15",
sum(decode(to_char(first_time, 'hh24'),'16',1,0)) "h16",
sum(decode(to_char(first_time, 'hh24'),'17',1,0)) "h17",
sum(decode(to_char(first_time, 'hh24'),'18',1,0)) "h18",
sum(decode(to_char(first_time, 'hh24'),'19',1,0)) "h19",
sum(decode(to_char(first_time, 'hh24'),'20',1,0)) "h20",
sum(decode(to_char(first_time, 'hh24'),'21',1,0)) "h21",
sum(decode(to_char(first_time, 'hh24'),'22',1,0)) "h22",
sum(decode(to_char(first_time, 'hh24'),'23',1,0)) "h23"
from v$archived_log
group by to_char(first_time, 'yyyy-mm-dd Dy')
order by 1;