<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Performance on Café Com Cloud</title><link>https://blog.cafecomcloud.com.br/categories/performance/</link><description>Recent content in Performance on Café Com Cloud</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Thu, 25 May 2017 18:37:21 -0300</lastBuildDate><atom:link href="https://blog.cafecomcloud.com.br/categories/performance/index.xml" rel="self" type="application/rss+xml"/><item><title>db_multiblock_read_count - to be or not to be?</title><link>https://blog.cafecomcloud.com.br/2017/05/25/db_multiblock_read_count-to-be-or-not-to-be/</link><pubDate>Thu, 25 May 2017 18:37:21 -0300</pubDate><guid>https://blog.cafecomcloud.com.br/2017/05/25/db_multiblock_read_count-to-be-or-not-to-be/</guid><description>&lt;p&gt;Sometimes you wanna to use things with default options&amp;hellip;and sometimes the default is not good enough.&lt;/p&gt;
&lt;p&gt;We all know that db_file_multiblock_read_count is bumped by default on startup, usually you get 128 blocks per read. Why?&lt;/p&gt;
&lt;p&gt;From Oracle documentation, this value is high, but CBO will not favor full tables scans.&lt;/p&gt;
&lt;p&gt;&amp;ldquo;Even though the default value may be a large value, the optimizer will not favor large plans if you do not set this parameter. It would do so only if you explicitly set this parameter to a large value.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;Okay. But Why? From a 10053 trace within a session, you can see that the CBO will compute db_file_multiblock_read_count always as &amp;ldquo;8&amp;rdquo;&amp;hellip;even if you see 128 in spfile.&lt;/p&gt;
&lt;p&gt;CBO you always use 8, if you dont set db_file_multiblock_read_count explicitly. How to know if you set db_file_multiblock_read_count as 128? Use this:&lt;/p&gt;
&lt;h5 id="select-nvlvaluenull-as-value-from-vspparameter-where-name--db_file_multiblock_read_count"&gt;SELECT nvl(value,&amp;rsquo;*NULL*&amp;rsquo;) AS value FROM v$spparameter WHERE name = &amp;lsquo;db_file_multiblock_read_count&amp;rsquo;;
&lt;/h5&gt;&lt;p&gt;If this return *NULL*, you have not set db_file_multiblock_read_count, Oracle is showing you 128, but CBO uses 8. Sad no?&lt;/p&gt;
&lt;p&gt;You all read the documentation and know the effects of bumping db_file_multiblock_read_count high. Full table scans will happen more often and as a result, in a OLTP system, usually you will get a call from your boss (hehe)&lt;/p&gt;
&lt;p&gt;But there is a way to set correctly the db_file_multiblock_read_count&amp;hellip;by testing&amp;hellip;for example, take a look on the block below. Its silly, I know, but it can give you a magic value for this parameter.&lt;/p&gt;
&lt;h5 id="set-serveroutput-on-declare-l_count-pls_integer-l_time-pls_integer-l_starting_time-pls_integer-l_ending_time-pls_integer-begin-dbms_outputput_linedbfmbrc-seconds-for-l_dbfmbrc-in-164-loop-execute-immediate-alter-session-set-db_file_multiblock_read_countl_dbfmbrc-execute-immediate-alter-system-flush-buffer_cache-execute-immediate-alter-session-disable-parallel-dml-l_starting_time--dbms_utilityget_time-select--fullt--count-into-l_count-from-big_table-t-l_ending_time--dbms_utilityget_time-l_time--roundl_ending_time-l_starting_time100-dbms_outputput_linel_dbfmbrc-l_time-end-loop-end-"&gt;set serveroutput on DECLARE l_count PLS_INTEGER; l_time PLS_INTEGER; l_starting_time PLS_INTEGER; l_ending_time PLS_INTEGER; BEGIN dbms_output.put_line(&amp;lsquo;dbfmbrc seconds&amp;rsquo;); FOR l_dbfmbrc IN 1..64 LOOP EXECUTE IMMEDIATE &amp;lsquo;ALTER SESSION SET db_file_multiblock_read_count=&amp;rsquo;||l_dbfmbrc; EXECUTE IMMEDIATE &amp;lsquo;ALTER system flush buffer_cache&amp;rsquo;; EXECUTE IMMEDIATE &amp;lsquo;ALTER session disable parallel dml&amp;rsquo;; l_starting_time := dbms_utility.get_time(); SELECT /*+ full(t) */ count(*) INTO l_count FROM big_table t; l_ending_time := dbms_utility.get_time(); l_time := round((l_ending_time-l_starting_time)/100); dbms_output.put_line(l_dbfmbrc||&amp;rsquo; &amp;lsquo;||l_time); END LOOP; END; /
&lt;/h5&gt;&lt;p&gt;(Thanks to Chris Antognini, you&amp;rsquo;re great)&lt;/p&gt;
&lt;p&gt;With this block (be carefull, it will take 60-90 minutes depending of the big table&amp;rsquo;s size, as a advice, use a 5GB table), you will have values, plot a graph and see the behavior. Dont choose a high value for OLTP.&lt;/p&gt;
&lt;p&gt;See you around!&lt;/p&gt;</description></item><item><title>Using oradebug - 10053 and 10046 events</title><link>https://blog.cafecomcloud.com.br/2017/02/27/using-oradebug-10053-and-10046-events/</link><pubDate>Mon, 27 Feb 2017 12:00:06 -0300</pubDate><guid>https://blog.cafecomcloud.com.br/2017/02/27/using-oradebug-10053-and-10046-events/</guid><description>&lt;p&gt;Hello There! Hope this article finds you well. Today we will talk about oradebug, this little wonder in oracle, and how to set the 10046 and 10053 events to troubleshoot performance.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;First of all, what is oradebug?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Oradebug is a sqlplus tool, intended to oracle support personel only - however, it can be very handy in a bunch of situations. You can use it to set specific troubleshooting events, use to diagnose on which interface your RAC is using for the interconnect messages, use to execute a hanganalyze ( the command, not me, okay? =] ), system state dumps, errorstack dumps and the list goes on.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How do I use it?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;First of all, you need to attach oradebug to a specific session/process.&lt;/p&gt;
&lt;p&gt;Using the ospid:&lt;/p&gt;
&lt;p&gt;Get the os pid for the process, usually with and ps command, or getting the thread in windows environment. With the ospid (in this example 1177)&lt;/p&gt;
&lt;p&gt;oradebug setospid 1177;&lt;/p&gt;
&lt;p&gt;If you try to attach oradebug to an inactive process, you will receive:&lt;/p&gt;
&lt;p&gt;SQL&amp;gt; oradebug setospid 13050; ORA-00072: process &amp;ldquo;13050&amp;rdquo; is not active&lt;/p&gt;
&lt;p&gt;If everything went smoothly, you will receive:&lt;/p&gt;
&lt;p&gt;SQL&amp;gt; oradebug setospid 16792; Oracle pid: 150, Unix process pid: 16792, image: oracle@BLASERVER12&lt;/p&gt;
&lt;p&gt;Using the SID to attach oradebug:&lt;/p&gt;
&lt;p&gt;First of all you need to find out the orapid for the session, running the sql below:&lt;/p&gt;
&lt;p&gt;select p.pid orapid from v$process p, v$session s where s.sid = &amp;amp;SID and p.addr = s.paddr /&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;p&gt;SQL&amp;gt; select p.pid orapid from v$process p, v$session s where s.sid = &amp;amp;SID and p.addr = s.paddr / 2 3 4 5 6 Enter value for sid: 651 old 4: where s.sid = &amp;amp;SID new 4: where s.sid = 651&lt;/p&gt;
&lt;p&gt;ORAPID &amp;mdash;&amp;mdash;&amp;mdash;- 152&lt;/p&gt;
&lt;p&gt;SQL&amp;gt; oradebug setorapid 152; Oracle pid: 152, Unix process pid: 5392, image: oracle@BLASERVER12 (TNS V1-V3)&lt;/p&gt;
&lt;p&gt;You are ready to go!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Setting the 10046 event&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;oradebug event 10046 trace name context forever, level 12;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Setting the 10053 event&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;oradebug event 10053 trace name context forever, level 1;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this is important?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You can use the 10046 to get sql specific informations, such as object, parsing, elapsed time, wait events, bind variables. It is an alternativa for dbms_monitor and dbms_system, another way to generate a sessions trace, and it could be &amp;ldquo;tkprofed&amp;rdquo; as well.&lt;/p&gt;
&lt;p&gt;If you wanna to understand the optimizer&amp;rsquo;s decicions, there is no better way that using a 10053 trace. You will understand the cost estimates, access paths, query block names, peeked binds, optimizer parameters used during the parse.&lt;/p&gt;
&lt;p&gt;In another post I&amp;rsquo;ll give detail about the levels, and why we type &amp;ldquo;name context forever&amp;rdquo;. This is a how to post only =]&lt;/p&gt;
&lt;p&gt;See you around!&lt;/p&gt;</description></item></channel></rss>