{"id":175,"date":"2024-02-21T13:50:32","date_gmt":"2024-02-21T11:50:32","guid":{"rendered":"http:\/\/130.61.57.200\/?p=175"},"modified":"2024-02-29T10:33:56","modified_gmt":"2024-02-29T08:33:56","slug":"log-switches-per-hour","status":"publish","type":"post","link":"http:\/\/130.61.57.200\/index.php\/2024\/02\/21\/log-switches-per-hour\/","title":{"rendered":"Log switches per hour and archive log space"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Find the log switches with following query:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>SELECT TRUNC (first_time) &quot;Date&quot;, TO_CHAR (first_time, &#039;Dy&#039;) &quot;Day&quot;,&lt;br&gt;COUNT (1) &quot;Total&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;00&#039;, 1, 0)) &quot;h0&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;01&#039;, 1, 0)) &quot;h1&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;02&#039;, 1, 0)) &quot;h2&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;03&#039;, 1, 0)) &quot;h3&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;04&#039;, 1, 0)) &quot;h4&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;05&#039;, 1, 0)) &quot;h5&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;06&#039;, 1, 0)) &quot;h6&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;07&#039;, 1, 0)) &quot;h7&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;08&#039;, 1, 0)) &quot;h8&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;09&#039;, 1, 0)) &quot;h9&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;10&#039;, 1, 0)) &quot;h10&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;11&#039;, 1, 0)) &quot;h11&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;12&#039;, 1, 0)) &quot;h12&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;13&#039;, 1, 0)) &quot;h13&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;14&#039;, 1, 0)) &quot;h14&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;15&#039;, 1, 0)) &quot;h15&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;16&#039;, 1, 0)) &quot;h16&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;17&#039;, 1, 0)) &quot;h17&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;18&#039;, 1, 0)) &quot;h18&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;19&#039;, 1, 0)) &quot;h19&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;20&#039;, 1, 0)) &quot;h20&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;21&#039;, 1, 0)) &quot;h21&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;22&#039;, 1, 0)) &quot;h22&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;23&#039;, 1, 0)) &quot;h23&quot;&lt;br&gt;FROM gv$log_history&lt;br&gt;GROUP BY TRUNC (first_time), TO_CHAR (first_time, &#039;Dy&#039;)&lt;br&gt;ORDER BY 1;<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Calculate Fast Recovery Area size needs by monitoring the Archive logs production. Use the following query to see a per hour Archive data production:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>SELECT TO_CHAR(FIRST_TIME,&#039;MM-DD&#039;) DAY,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;00&#039;,MB,0))) AS &quot;00&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;01&#039;,MB,0))) AS &quot;01&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;02&#039;,MB,0))) AS &quot;02&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;03&#039;,MB,0))) AS &quot;03&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;04&#039;,MB,0))) AS &quot;04&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;05&#039;,MB,0))) AS &quot;05&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;06&#039;,MB,0))) AS &quot;06&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;07&#039;,MB,0))) AS &quot;07&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;08&#039;,MB,0))) AS &quot;08&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;09&#039;,MB,0))) AS &quot;09&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;10&#039;,MB,0))) AS &quot;10&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;11&#039;,MB,0))) AS &quot;11&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;12&#039;,MB,0))) AS &quot;12&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;13&#039;,MB,0))) AS &quot;13&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;14&#039;,MB,0))) AS &quot;14&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;15&#039;,MB,0))) AS &quot;15&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;16&#039;,MB,0))) AS &quot;16&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;17&#039;,MB,0))) AS &quot;17&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;18&#039;,MB,0))) AS &quot;18&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;19&#039;,MB,0))) AS &quot;19&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;20&#039;,MB,0))) AS &quot;20&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;21&#039;,MB,0))) AS &quot;21&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;22&#039;,MB,0))) AS &quot;22&quot;,&lt;br&gt;ROUND(SUM(DECODE(TO_CHAR(FIRST_TIME,&#039;HH24&#039;),&#039;23&#039;,MB,0))) AS &quot;23&quot;,&lt;br&gt;ROUND(SUM(MB)) as &quot;Tot&quot;&lt;br&gt;FROM (SELECT DISTINCT SEQUENCE#, (BLOCKS*BLOCK_SIZE)\/1048576 mb, FIRST_TIME FROM V$ARCHIVED_LOG)&lt;br&gt;GROUP BY TO_CHAR(FIRST_TIME,&#039;MM-DD&#039;)&lt;br&gt;ORDER BY 1;<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Same information can be extracted by:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>select SUM (BLOCKS*BLOCK_SIZE)\/1048576 mb, trunc(FIRST_TIME,&#039;HH24&#039;) FROM V$ARCHIVED_LOG&lt;br&gt;group by trunc(FIRST_TIME,&#039;HH24&#039;)&lt;br&gt;order by 2<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Find the log switches with following query: SELECT TRUNC (first_time) &quot;Date&quot;, TO_CHAR (first_time, &#039;Dy&#039;) &quot;Day&quot;,&lt;br&gt;COUNT (1) &quot;Total&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;00&#039;, 1, 0)) &quot;h0&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;01&#039;, 1, 0)) &quot;h1&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;02&#039;, 1, 0)) &quot;h2&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;03&#039;, 1, 0)) &quot;h3&quot;,&lt;br&gt;SUM (DECODE (TO_CHAR (first_time, &#039;hh24&#039;), &#039;04&#039;, 1, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":106,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[52,30],"class_list":["post-175","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle","tag-archive-logs","tag-log"],"blocksy_meta":[],"_links":{"self":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts\/175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/comments?post=175"}],"version-history":[{"count":2,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts\/175\/revisions"}],"predecessor-version":[{"id":177,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts\/175\/revisions\/177"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/media\/106"}],"wp:attachment":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/media?parent=175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/categories?post=175"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/tags?post=175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}