Here is a script to track archive log switching by the day and by the hour. Since most of the work on our databases...
take place between the 1st and 7th of the month, the script is limited by that. It shows you the number of switches by the hour and by the day. It's very informative when deciding on log sizes and the number of logs.
--Shows archive log history --ARCHIVE LOGS SWITCHES BROKEN DOWN BY THE HOUR SINCE THE FIRST OF THE MONTH set pages 500 set lines 132 set pause off column TIMESTAMP format a17 break on DAY COMPUTE SUM OF SWITCHES ON DAY break on day SELECT TO_CHAR(TRUNC(H.first_time),'DD-MON-YYYY') "DAY" ,TO_CHAR(H.FIRST_TIME,'HH24')||':00' "HOUR" ,count(*) "SWITCHES" ,TO_CHAR(AVG(A.blocks*a.block_size),'999,999,999,999') "AVGBYTES" FROM V$LOGHIST H ,V$ARCHIVED_LOG A WHERE H.SEQUENCE#=A.SEQUENCE# --AND H.FIRST_TIME > SYSDATE - 10 AND H.FIRST_TIME > LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE),-1))+1 GROUP BY TRUNC(H.first_time) ,TO_CHAR(H.FIRST_TIME,'HH24') ORDER BY TRUNC(H.first_time) DESC ,TO_NUMBER(TO_CHAR(H.FIRST_TIME,'HH24')) /
Jeff W. writes: This tip looks worthwhile. Unfortunately, it does not run on our version of Oracle (7.3.4).
For More Information
- What do you think about this tip? E-mail the editor at firstname.lastname@example.org with your feedback.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize--submit your tip today!
- Ask your technical Oracle questions--or help out your peers by answering them--in our live discussion forums.
- Check out our Ask the Experts feature: Our SQL, database design, Oracle, SQL Server, DB2, metadata, and data warehousing gurus are waiting to answer your toughest questions.