{
  "date": "2016-07-16T20:24:19",
  "slug": "amm-and-asmm-derived-parameters",
  "link": "https://www.dbi-services.com/blog/amm-and-asmm-derived-parameters/",
  "title": {
    "rendered": "AMM and ASMM derived parameters"
  },
  "content": {
    "rendered": "<h2>By Franck Pachot</h2>\n<p>.<br />\nThe latest <a href=\"https://www.dbi-services.com/trainings/oracle-dba-essentials-workshop/\" target=\"_blank\" rel=\"noopener noreferrer\">DBA Essentials Workshop</a> training I&#8217;ve given raised a question about PGA_AGGREGATE_LIMIT. The default depends on PGA_AGGREGATE_TARGET. So how is it calculated in AMM where PGA_AGGREGATE_TARGET is dynamic? Is it also dynamic or is it determined by the value at instance startup only?<br />\n<!--more--><br />\nThe PGA_AGGREGATE_LIMIT default value is <a href=\"https://docs.oracle.com/database/121/REFRN/GUID-E364D0E5-19F2-4081-B55E-131DF09CFDB3.htm#REFRN10328\" target=\"_blank\" rel=\"noopener noreferrer\">documented</a>. I&#8217;ll use the following query to display the values of the concerned parameters:</p>\n<pre><code>\nselect\ndbms_stats_internal.get_parameter_val('pga_aggregate_limit')/1024/1024/1024 \"pga_aggregate_limit\",\n 2 \"2GB\",\n 3*dbms_stats_internal.get_parameter_val('processes')/1024 \"3MB*processes\",\n 2*dbms_stats_internal.get_parameter_val('__pga_aggregate_target')/1024/1024/1024 \"2*__pga_aggregate_target\",\n dbms_stats_internal.get_parameter_val('__sga_target')/1024/1024/1024 \"__sga_target\",\n dbms_stats_internal.get_parameter_val('__pga_aggregate_target')/1024/1024/1024 \"__pga_aggregate_target\"\nfrom dual\n/\n</code></pre>\n<p>and I start with the following:</p>\n<pre><code>\npga_aggregate_limit        2GB 3MB*processes 2*__pga_aggregate_target __sga_target __pga_aggregate_target\n------------------- ---------- ------------- ------------------------ ------------ ----------------------\n            2.40625          2     .87890625                  2.40625     1.796875               1.203125\n</code></pre>\n<p>I&#8217;m in AMM with only MEMORY_TARGET set to 3G. The dynamic SGA is at 1.8G and the PGA at 1.2G. The PGA_AGGREGATE_LIMIT is at 200% of the PGA which is 2.4G</p>\n<p>I increase the SGA in order to see a resize of the PGA</p>\n<pre><code>\nSQL&gt; alter system set sga_target=2500M;\nSystem altered.\n</code></pre>\n<p>The PGA is now about 500M in order to release some space for SGA:</p>\n<pre><code>pga_aggregate_limit        2GB 3MB*processes 2*__pga_aggregate_target __sga_target __pga_aggregate_target\n------------------- ---------- ------------- ------------------------ ------------ ----------------------\n            2.40625          2     .87890625                  1.09375     1.796875                .546875\n</code></pre>\n<p>However, the PGA_AGGREGATE_LIMIT did no change. the formula is not dynamic. The value that has been calculated at startup remains.</p>\n<h3>spfile</h3>\n<p>When dynamic components are resized, the values are written into the spfile with double underscore parameters, so that a restart of the instance starts with same value:</p>\n<pre><code>SQL&gt; host strings /u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfileCDB.ora     | grep target\nCDB.__pga_aggregate_target=587202560\nCDB.__sga_target=1929379840\n*.memory_max_target=5G\n*.memory_target=3G\n.sga_target=2634022912</code></pre>\n<p>So let&#8217;s restart and see what happens to PGA_AGGREGATE_LIMIT (which has no double underscore entry in spfile)</p>\n<pre><code>SQL&gt; startup force\nORACLE instance started.\n&nbsp;\nTotal System Global Area 5368709120 bytes\nFixed Size                  2935712 bytes\nVariable Size            3976201312 bytes\nDatabase Buffers          721420288 bytes\nRedo Buffers               13840384 bytes\nIn-Memory Area            654311424 bytes\nDatabase mounted.\nDatabase opened.\n&nbsp;\nSQL&gt; select\n  2   dbms_stats_internal.get_parameter_val('pga_aggregate_limit')/1024/1024/1024 \"pga_aggregate_limit\",\n  3   2 \"2GB\",\n  4   3*dbms_stats_internal.get_parameter_val('processes')/1024 \"3MB*processes\",\n  5   2*dbms_stats_internal.get_parameter_val('__pga_aggregate_target')/1024/1024/1024 \"2*__pga_aggregate_target\",\n  6   dbms_stats_internal.get_parameter_val('__sga_target')/1024/1024/1024 \"__sga_target\",\n  7   dbms_stats_internal.get_parameter_val('__pga_aggregate_target')/1024/1024/1024 \"__pga_aggregate_target\"\n  8   from dual\n  9  /\n&nbsp;\npga_aggregate_limit        2GB 3MB*processes 2*__pga_aggregate_target __sga_target __pga_aggregate_target\n------------------- ---------- ------------- ------------------------ ------------ ----------------------\n                  2          2     .87890625                  1.09375     2.453125                .546875\n</code></pre>\n<p>The good thing is that the value is calculated from the actual values. Here 200% of PGA is smaller than 2G so 2G is used.</p>\n<p>The bad thing is that a restart of the instance may bring a different behavior than before than restart.</p>\n<h3>So what?</h3>\n<p>This instability is easy to solve: don&#8217;t use AMM. SGA and PGA are different things and you should size them separately.<br />\nBut the problem is wider. There are other parameters that can show same behavior. For example, the default db_file_multiblock_read_count can be limited by processes x __db_block_buffers.<br />\nYou may have to change some values either manually or automatically at the start of a new application because you don&#8217;t know which is the best setting. But once the application is more stable, you should stabilize the dynamic sizing by setting minimum values.</p>\n",
    "protected": false
  }
}
