<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OS与Oracle &#187; AWR分析</title>
	<atom:link href="http://www.os2ora.com/tag/awr%e5%88%86%e6%9e%90/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.os2ora.com</link>
	<description>专注于现实世界Oracle数据库的高性能，高可扩展性与新一代数据库Exadata架构</description>
	<lastBuildDate>Mon, 19 Sep 2011 09:10:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>如何分析AWR (5)</title>
		<link>http://www.os2ora.com/how-to-analyze-awr-report-5/</link>
		<comments>http://www.os2ora.com/how-to-analyze-awr-report-5/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 17:21:24 +0000</pubDate>
		<dc:creator>Kaya</dc:creator>
				<category><![CDATA[Oracle管理与维护]]></category>
		<category><![CDATA[数据库性能调优]]></category>
		<category><![CDATA[AWR]]></category>
		<category><![CDATA[AWR分析]]></category>
		<category><![CDATA[CPU used by this session]]></category>
		<category><![CDATA[DB CPU]]></category>
		<category><![CDATA[DB Time]]></category>

		<guid isPermaLink="false">http://www.os2ora.com/how-to-analyze-awr-report-5/</guid>
		<description><![CDATA[有一次跟一个QQ上的朋友一起探讨了另一个对系统CPU进行度量的指标: CPU used by this session。
他刚好有一份AWR报告，在这份报告里，出现了严重的CPU used by this session和DB CPU不一致的现象......]]></description>
			<content:encoded><![CDATA[<p>Kaya 发表于 <a href="http://www.os2ora.com/">os2ora.com</a></p>
<p>有一次跟一个QQ上的朋友一起探讨了另一个对系统CPU进行度量的指标: CPU used by this session。</p>
<p>他刚好有一份AWR报告，在这份报告里，出现了严重的CPU used by this session和DB CPU不一致的现象。</p>
<p>下面是这份报告的一些片断</p>
<p><a href="http://www.os2ora.com/wp-content/uploads/2009/12/image.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="119" alt="image" src="http://www.os2ora.com/wp-content/uploads/2009/12/image_thumb.png" width="509" border="0" /></a> </p>
<p><a href="http://www.os2ora.com/wp-content/uploads/2009/12/image1.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="318" alt="image" src="http://www.os2ora.com/wp-content/uploads/2009/12/image_thumb1.png" width="359" border="0" /></a> </p>
<p><a href="http://www.os2ora.com/wp-content/uploads/2009/12/image2.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="395" alt="image" src="http://www.os2ora.com/wp-content/uploads/2009/12/image_thumb2.png" width="245" border="0" /></a> </p>
<p><a href="http://www.os2ora.com/wp-content/uploads/2009/12/image3.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="56" alt="image" src="http://www.os2ora.com/wp-content/uploads/2009/12/image_thumb3.png" width="524" border="0" /></a> </p>
<p>再做进一步的归纳：</p>
<p>OS Busy% = 1821080/(1821080+5384293) = 25%</p>
<p>Inst CPU% (using DB CPU) = 8934.22*100/(1821080+5384293)=12%</p>
<p>Inst CPU% (using CPU used by this session) = 418035/(1821080+5384293) = 6%</p>
<p>用CPU used by this session计算出的CPU利用率竟然只是用DB CPU计算出来的利用通率的一半！</p>
<p>我的第一个反应是在Jonathan lewis网站看到的一篇相关文章，里面提到了<a href="http://jonathanlewis.wordpress.com/2009/05/26/cpu-used/">DB CPU和CPU used by this session计算时的不同之处:</a></p>
<p><span class="Apple-style-span" style="word-spacing: 0px; font: medium &#39;Times New Roman&#39;; text-transform: none; color: rgb(0,0,0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"><span class="Apple-style-span" style="font-size: 13px; line-height: 21px; font-family: verdana, tahoma, arial, sans-serif">“</span></span><span class="Apple-style-span" style="word-spacing: 0px; font: medium &#39;Times New Roman&#39;; text-transform: none; color: rgb(0,0,0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"><span class="Apple-style-span" style="font-size: 13px; line-height: 21px; font-family: verdana, tahoma, arial, sans-serif">prior to 10g Oracle usually updated time figures at the end of each database call; but from 10g there are some views where time is updated more regularly.</span></span></p>
<p><span class="Apple-style-span" style="word-spacing: 0px; font: medium &#39;Times New Roman&#39;; text-transform: none; color: rgb(0,0,0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"><span class="Apple-style-span" style="font-size: 13px; line-height: 21px; font-family: verdana, tahoma, arial, sans-serif"><span class="Apple-style-span" style="word-spacing: 0px; font: medium &#39;Times New Roman&#39;; text-transform: none; color: rgb(0,0,0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"><span class="Apple-style-span" style="font-size: 13px; line-height: 21px; font-family: verdana, tahoma, arial, sans-serif">The<span class="Apple-converted-space">&#160;</span><em>“DB CPU”</em><span class="Apple-converted-space">&#160;</span>from<span class="Apple-converted-space">&#160;</span><em><strong>v$sess_time_model</strong></em><span class="Apple-converted-space">&#160;</span>increases every six seconds, while the<span class="Apple-converted-space">&#160;</span><em>“CPU used by this session”</em><span class="Apple-converted-space">&#160;</span>from<span class="Apple-converted-space">&#160;</span><em><strong>v$sesstat </strong></em>changes only at the end of the test.”</span></span></span></span></p>
<p>如何验证这一点呢？</p>
<p>在浏览这份报告的TOP SQL时，我们发现了下面的现象：</p>
<p><a href="http://www.os2ora.com/wp-content/uploads/2009/12/image4.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="91" alt="image" src="http://www.os2ora.com/wp-content/uploads/2009/12/image_thumb4.png" width="563" border="0" /></a> </p>
<p>这是从SQL ordered by Elapsed Time截取出来的Top 3 SQL。TOP 1的SQL用了DB Time的30.10%，用了2517s 的CPU Time。但请注意它的Executions的值却为0。也就是说，这里的CPU Time是还没有被计算入CPU used by this session这个指标里面的。</p>
<p>我们再把2517s加回来，看出误差缩小多少:(251700+418035)/(1821080+5384293) = 9%</p>
<p>这时和用DB CPU计算出来的12%还是有1/4的差距。</p>
<p>从这个例子可以看出，用DB CPU度量还是比用CPU used by this session来得准确的。特别在有大查询在跑的过程中抓的AWR，这个误差很有可能会被放大。</p>
<p>一个有趣的实际例子。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.os2ora.com/how-to-analyze-awr-report-5/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Oracle性能分析工具概览与开发设想</title>
		<link>http://www.os2ora.com/oracle-performance-analysis-tool-overview-and-design/</link>
		<comments>http://www.os2ora.com/oracle-performance-analysis-tool-overview-and-design/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 16:29:51 +0000</pubDate>
		<dc:creator>Kaya</dc:creator>
				<category><![CDATA[Linux性能调优]]></category>
		<category><![CDATA[数据库性能调优]]></category>
		<category><![CDATA[Analyser]]></category>
		<category><![CDATA[ASH]]></category>
		<category><![CDATA[AWR]]></category>
		<category><![CDATA[AWR analysis]]></category>
		<category><![CDATA[AWR分析]]></category>
		<category><![CDATA[AWR快照]]></category>
		<category><![CDATA[AWR报告]]></category>
		<category><![CDATA[EM]]></category>
		<category><![CDATA[Enterprise Manager]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[Oracle监控]]></category>
		<category><![CDATA[Oracle监控工具]]></category>
		<category><![CDATA[snapshot]]></category>
		<category><![CDATA[v$sysstat]]></category>
		<category><![CDATA[趋势曲线]]></category>

		<guid isPermaLink="false">http://www.os2ora.com/oracle-performance-analysis-tool-overview-and-design/</guid>
		<description><![CDATA[上一篇文章提到的那些个工具，主要侧重点在于实时监控，而在我看来，实时监控只是一个监控工具的一个职责而已。就如Linux上的collectl或者nmon一样，我们还需要对这些历史性能数据进行保存，以便于过后进行分析。而且，这也是一个不可或缺的功能，毕竟，DBA不会也不可能24小时盯着屏幕，DBA做的主要事情应该是对历史数据进行分析从而更好的认识数据库的工作状态。

监控工具方面，也有很多实现这方面需求的软件。记得anySQL.net上面就有一个类似的监控工具。通过收集v$sysstat和v$session的数据，再利用图表的方式进行分析。这应该是这类软件的共性。

但有一个”工具”值得大提特提，那就是Oracle自身的AWR。AWR默认一个小时对系统做一次快照，这些快照其实是难得的历史性能数据，Oracle自带的AWR报告，主要是基于两个快照间的分析，因此只能得到一些孤立的数值。如果我们能够更进一步，实现对所有快照数据的分析，我们就能清晰地了解系统过去一段时间（默认AWR保留7天）的工作负载的特征曲线，各种重要指标的变化曲线。我想，这些曲线对于DBA或者决策层而言都是极其有用的......]]></description>
			<content:encoded><![CDATA[<p>Kaya 发表于 <a href="http://www.os2ora.com/">os2ora.com</a></p>
<p><a href="http://www.os2ora.com/oracle-monitoring-tool-summary-and-recommend/">上一篇文章</a>提到的那些个工具，主要侧重点在于实时监控，而在我看来，实时监控只是一个监控工具的一个职责而已。就如Linux上的collectl或者nmon一样，我们还需要对这些历史性能数据进行保存，以便于过后进行分析。而且，这也是一个不可或缺的功能，毕竟，DBA不会也不可能24小时盯着屏幕，DBA做的主要事情应该是对历史数据进行分析，从而更好的认识数据库的工作状态。</p>
<p>监控工具方面，也有很多实现这方面需求的软件。记得<a href="http://www.anysql.net">anySQL.net</a>上面就有一个类似的监控工具。通过收集v$sysstat和v$session的数据，再利用图表的方式进行分析。这应该是这类软件的共性。</p>
<p>但有一个”工具”值得大提特提，那就是Oracle自身的AWR。AWR默认一个小时对系统做一次快照，这些快照其实就是难得的历史性能数据，Oracle自带的AWR报告，主要是基于两个快照间的分析，因此只能得到一些孤立的数值。如果我们能够更进一步，实现对所有快照数据的分析，我们就能清晰地了解系统过去一段时间（默认AWR保留7天）的工作负载的特征曲线，各种重要指标的变化曲线。我想，这些曲线对于DBA或者决策层而言都是极其有价值的。</p>
<p>对这些曲线进行部分展示的，就是Enterprise Manager了。在Performance这个Tab里面，可以选择按Historical浏览的方式。这其实就是对AWR Repository里的数据进行查询。不过EM只提供对一天时间跨度的drill down，所提供的曲线也比较有限，归纳起来，11g里EM提供的主要曲线有：</p>
<ol>
<li>Average Active Sessions – 7 Day View </li>
<li>Host: Runnable Processes&#160; &#8211; 1 Day </li>
<li>Average Active Sessions &#8211; 1 Day </li>
<li>Logon/Transaction Rate &#8211; 1 Day </li>
<li>Physical Reads/Redo Size Rate &#8211; 1 Day </li>
<li>Latency For Synchronous Single Block Reads &#8211; 1 Day </li>
<li>I/O Megabytes per Second by I/O Function &#8211; 1 Day </li>
<li>I/O Request per Second by I/O Function &#8211; 1 Day </li>
<li>Sessions of Parallel Execution &#8211; 1 Day </li>
<li>Active Sessions of Services &#8211; 1 Day </li>
</ol>
<p>网络上实现类似功能的软件好象不多(知道的朋友请多comment一下)，不过，碰巧也找到了一个，叫做<a href="http://www.ondataperf.com">ONDATAPERF</a>。通过用户上传一系列的Statspack或者AWR报告，最后<em>据说</em>会产生一个类似这个链接的<a href="http://www.ondatafine.com/demo_odp_eng.pdf">ONDATAPERF report</a>。这个报告里面的图表看起来还是很酷的，随便抓一个ASH的例子。</p>
<p><a href="http://www.os2ora.com/wp-content/uploads/2009/11/image15.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="220" alt="image" src="http://www.os2ora.com/wp-content/uploads/2009/11/image_thumb14.png" width="804" border="0" /></a> </p>
<p>当然，唯一的缺点是这是一个付费服务。</p>
<p>其实，要自己实现类似的功能或者更全面的图表也不是很难的一件事情。可以考虑参考nmon的Analyser，做一个专门针对AWR Repository的Analayser出来。这应该是挺有意义，挺有先驱性的一件事情。要真有这个工具，说不定可以和这个ONDATAPERF 竞争一番呢!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.os2ora.com/oracle-performance-analysis-tool-overview-and-design/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

