Here is a script that I use, which creates a procedure called logtime. You call it, providing it with a parameter which is the last x log switches you want to know the time of...
 
create or replace procedure logtime(p_logs in number default 20) as
 
   v_no_of_logs number :=p_logs;
 
   v_buffersize number := v_no_of_logs*35;
 
   cursor cur_countlog is
   select count(*) cnt
     from v$log_history;
 
   cursor cur_gettimes(p_count number) is
   select rpad(sequence#,8) seq,
          to_char(first_time,'DD-MON-YYYY:HH24:MI:SS') TIME
     from v$log_history
    where rownum<=p_count
   minus
   select rpad(sequence#,8) seq,
          to_char(first_time,'DD-MON-YYYY:HH24:MI:SS') TIME
     from v$log_history
    where rownum<=p_count-v_no_of_logs;
 
begin
 

   dbms_output.enable(v_buffersize);
   dbms_output.put_line('SEQ#     TIME');
   dbms_output.put_line('-----------------------------');
 
   for cur_countlogrec in cur_countlog loop
 
      for cur_gettimesrec in cur_gettimes(cur_countlogrec.cnt) loop
 
         dbms_output.put_line(cur_gettimesrec.seq||' '||cur_gettimesrec.time);
 
      end loop;
 
   end loop;
 
end;
/

Reply via email to