{"id":270,"date":"2023-02-01T14:50:06","date_gmt":"2023-02-01T13:50:06","guid":{"rendered":"https:\/\/oracledba.fr\/?p=270"},"modified":"2023-02-01T15:01:55","modified_gmt":"2023-02-01T14:01:55","slug":"high-pga-memory-consumption-and-high-cpu-usage-is-observed-during-the-automatic-maintenance-task-execution","status":"publish","type":"post","link":"https:\/\/oracledba.fr\/?p=270","title":{"rendered":"High PGA memory consumption and high CPU usage is observed during the automatic maintenance task execution"},"content":{"rendered":"\n<p>Last, times, we noticed high cpu and memory usage  on our database server.  Top memory consuming process was some ora_j000_* process which are spawned as part of execution of auto task scheduler job . It was using also lots of swap.<\/p>\n\n\n\n<p>After reviewing, we found that the process was running &#8220;Optimizer statistics advisor&#8221; task name AUTO_STATS_ADVISOR_TASK ( job name ORA$AT_OS_OPT_SY_&lt;&#8230;&gt;)<\/p>\n\n\n\n<p>And it was executing following recursive SQL:<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-text-color\"><code lang=\"sql\" class=\"language-sql\">SQL_ID: as2dr3ag24gay\nselect not_stale.obj# from (select s.obj# obj#, count(*) cnt, max(timestamp) max_time from\noptstat_snapshot$ s, wri$_optstat_tab_history t where s.obj# = t.obj# and bitand(s.flags, :gather_stats_flag) &gt; 0 and\nt.analyzetime = (select max(analyzetime) from wri$_optstat_tab_history where analyzetime &lt; s.timestamp) and\ndbms_stats_internal.is_stale(s.obj#, null, null, s.inserts + s.updates + s.deletes, t.rowcnt, 0) is null group by s.obj#) not_stale,\n(select obj# obj#, count(*) cnt from optstat_snapshot$ where bitand(flags, :gather_stats_flag) &gt; 0 group by obj#) total,\n(select obj#, max(timestamp) max_time from optstat_snapshot$ group by obj#) max where not_stale.obj# = total.obj# and\nnot_stale.cnt &gt; 0.5 * total.cnt and not_stale.obj# = max.obj# and not_stale.max_time = max.max_time and\ndbms_stats_internal.check_advisor_obj_filter(:rule_id, not_stale.obj#, :exec_mode) = 'T'<\/code><\/pre>\n\n\n\n<p>On oracle support site, we found that the issue is related to the following bug:<br>Bug 34201470 &#8211; JNNN PROCESSES CONSUMING 100% CPU AND HIGH MEMORY DURING AUTOTASK EXECUTION<\/p>\n\n\n\n<p>To resolve the issue, you can apply patch for&nbsp;<strong>Bug 34201470<br><\/strong>(Please note that this fix above does the same thing the workaround does below, it only turns off AUTO_STATS_ADVISOR_TASK)<\/p>\n\n\n\n<p>&nbsp;To workaround:&nbsp;&nbsp;<strong>exec dbms_stats.set_global_prefs(&#8216;AUTO_STATS_ADVISOR_TASK&#8217;, &#8216;FALSE&#8217;);<\/strong><\/p>\n\n\n\n<p>Please note that the Statistics Preference AUTO_STATS_ADVISOR_TASK is available ONLY when patch 26749785 is present otherwise, there is nothing that can be done.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last, times, we noticed high cpu and memory usage on our database server. Top memory consuming process was some ora_j000_* process which are spawned as part of execution of auto task scheduler job . It was using also lots of swap. After reviewing, we found that the process was running &#8220;Optimizer statistics advisor&#8221; task name &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/oracledba.fr\/?p=270\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;High PGA memory consumption and high CPU usage is observed during the automatic maintenance task execution&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-270","post","type-post","status-publish","format-standard","hentry","category-non-classe"],"_links":{"self":[{"href":"https:\/\/oracledba.fr\/index.php?rest_route=\/wp\/v2\/posts\/270","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oracledba.fr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oracledba.fr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oracledba.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oracledba.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=270"}],"version-history":[{"count":5,"href":"https:\/\/oracledba.fr\/index.php?rest_route=\/wp\/v2\/posts\/270\/revisions"}],"predecessor-version":[{"id":276,"href":"https:\/\/oracledba.fr\/index.php?rest_route=\/wp\/v2\/posts\/270\/revisions\/276"}],"wp:attachment":[{"href":"https:\/\/oracledba.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oracledba.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oracledba.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}