<?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>AnySQL.net &#187; Tuning</title>
	<atom:link href="http://www.anysql.net/tag/tuning/feed" rel="self" type="application/rss+xml" />
	<link>http://www.anysql.net</link>
	<description>SQLULDR2, DataCopy, DataSync, WebChart, OraMon, AUL/MyDUL, 性能优化及容量分析</description>
	<lastBuildDate>Wed, 14 Jul 2010 09:27:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>AIX下获得HBA卡的IO流量信息</title>
		<link>http://www.anysql.net/dba/get-aix-hba-iostat.html</link>
		<comments>http://www.anysql.net/dba/get-aix-hba-iostat.html#comments</comments>
		<pubDate>Wed, 14 Jul 2010 09:21:26 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[IO]]></category>
		<category><![CDATA[Tuning]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=769</guid>
		<description><![CDATA[&#160; &#160; IO历史是调优的兵家必争之地, 然而存贮厂商对IO的性能数据接口采用了保守的态度, 不对用户免费开放, 只提供定向开发服务, 没办法只能从主机这块入手了. 在AIX下可以用scsistat小程序来实时查看HBA卡上的流量. &#160; &#160; 在命令行不带参数运行时, 会将IO性能数据直接写在屏幕上. [oracle@test:/home/oracle/xinloufx]scsistat.bin 2010-07-14 17:07:15,test,fscsi2,2368,32,150,148,4 2010-07-14 17:07:15,test,fscsi3,2368,48,151,148,2 2010-07-14 17:07:15,test,fscsi0,2352,32,149,147,0 2010-07-14 17:07:15,test,fscsi1,2368,32,150,148,2 2010-07-14 17:07:25,test,fscsi2,2304,32,146,144,1 2010-07-14 17:07:25,test,fscsi3,2320,32,147,145,2 2010-07-14 17:07:25,test,fscsi0,2288,80,148,143,3 2010-07-14 17:07:25,test,fscsi1,2320,48,148,145,5 &#160; &#160; 各个列的数据依次为: 时间, 主机名, 光纤通道, RBLKS, WBLKS, XFERS, XRATE, IOTIME. 可以将数据用file选项输出到文件, 然后进行数据处理. scsistat.bin file=scsistat.dat wait=60 &#160; &#160; 上面的命令将会每分钟收集一次性能数据，并将性能数据写入到scsistat.dat文件. 画成曲线分析，将会更显效果. &#160; &#160; 上面的曲线可用AnySQL DataReport轻松制作出来. Relative Posts:2009/11/05 [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; IO历史是调优的兵家必争之地, 然而存贮厂商对IO的性能数据接口采用了保守的态度, 不对用户免费开放, 只提供定向开发服务, 没办法只能从主机这块入手了. 在AIX下可以用<a href="http://www.anysql.net/software/aixstat.tar">scsistat小程序</a>来实时查看HBA卡上的流量. </p>
<p>&nbsp; &nbsp; 在命令行不带参数运行时, 会将IO性能数据直接写在屏幕上. </p>
<blockquote class="prefont"><p>
[oracle@test:/home/oracle/xinloufx]scsistat.bin<br />
2010-07-14 17:07:15,test,fscsi2,2368,32,150,148,4<br />
2010-07-14 17:07:15,test,fscsi3,2368,48,151,148,2<br />
2010-07-14 17:07:15,test,fscsi0,2352,32,149,147,0<br />
2010-07-14 17:07:15,test,fscsi1,2368,32,150,148,2<br />
2010-07-14 17:07:25,test,fscsi2,2304,32,146,144,1<br />
2010-07-14 17:07:25,test,fscsi3,2320,32,147,145,2<br />
2010-07-14 17:07:25,test,fscsi0,2288,80,148,143,3<br />
2010-07-14 17:07:25,test,fscsi1,2320,48,148,145,5
</p></blockquote>
<p>&nbsp; &nbsp; 各个列的数据依次为: 时间, 主机名, 光纤通道, RBLKS, WBLKS, XFERS, XRATE, IOTIME. 可以将数据用file选项输出到文件, 然后进行数据处理. </p>
<blockquote class="prefont"><p>
scsistat.bin file=scsistat.dat wait=60
</p></blockquote>
<p>&nbsp; &nbsp; 上面的命令将会每分钟收集一次性能数据，并将性能数据写入到scsistat.dat文件. 画成曲线分析，将会更显效果.</p>
<blockquote><p>
<img src="http://www.anysql.net/images/aix_scsistat.png" border="0" />
</p></blockquote>
<p>&nbsp; &nbsp; 上面的曲线可用AnySQL DataReport轻松制作出来.</p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2009/11/05 -- <a href="http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html" title="oramon新增三个性能数据">oramon新增三个性能数据</a> (3)</li><li>2009/07/09 -- <a href="http://www.anysql.net/dba/oracle-where-filter-order.html" title="SQL执行filter条件的顺序问题">SQL执行filter条件的顺序问题</a> (2)</li><li>2009/07/01 -- <a href="http://www.anysql.net/dba/partition-table-statistics-choose.html" title="分区表用哪个级别的统计信息?">分区表用哪个级别的统计信息?</a> (2)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-system-event.html" title="oramon如何收集V$SYSTEM_EVENT数据?">oramon如何收集V$SYSTEM_EVENT数据?</a> (3)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-session-history.html" title="oramon如何从V$SESSION收集性能数据?">oramon如何从V$SESSION收集性能数据?</a> (0)</li><li>2009/06/24 -- <a href="http://www.anysql.net/oracle/oramon-system-statistics.html" title="oramon如何从V$SYSSTAT收集性能数据?">oramon如何从V$SYSSTAT收集性能数据?</a> (1)</li><li>2009/05/22 -- <a href="http://www.anysql.net/dba/benefit-from-oramon-perf-alert.html" title="从oramon新报警中受益">从oramon新报警中受益</a> (1)</li><li>2009/05/21 -- <a href="http://www.anysql.net/dba/oramon-database-perf-alert.html" title="用oramon的数据进行报警">用oramon的数据进行报警</a> (3)</li><li>2009/05/19 -- <a href="http://www.anysql.net/tools/deploy_new_oramon_version.html" title="新版oramon正式上线">新版oramon正式上线</a> (4)</li><li>2009/05/08 -- <a href="http://www.anysql.net/dba/analyze_perf_data_two.html" title="分析性能数据之二">分析性能数据之二</a> (5)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/dba/get-aix-hba-iostat.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux下获取IO压力数据</title>
		<link>http://www.anysql.net/dba/get-linux-iostat.html</link>
		<comments>http://www.anysql.net/dba/get-linux-iostat.html#comments</comments>
		<pubDate>Fri, 18 Jun 2010 08:16:49 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tuning]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=765</guid>
		<description><![CDATA[&#160; &#160; Linux 2.6内核版本后, 在proc文件系统中, 加入了存入磁盘IO访问数据的文件diskstats, 查看文件就可以获得某一时刻的累计访问值. $ cat /proc/diskstats &#160; &#8230;&#8230; &#160; 8&#160; &#160; 0 sda 130767120 478199 2848404253 865895766 &#8230; &#160; 8&#160; &#160; 1 sda1 58 740 1598 96 2 0 4 0 0 96 96 &#160; 8&#160; &#160; 2 sda2 4031326 3249 64502142 3693948 5273723 &#8230; &#160; 8&#160; &#160; 3 sda3 142 [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; Linux 2.6内核版本后, 在proc文件系统中, 加入了存入磁盘IO访问数据的文件diskstats, 查看文件就可以获得某一时刻的累计访问值. </p>
<blockquote class="prefont"><p>
$ cat /proc/diskstats<br />
&nbsp;  &#8230;&#8230;<br />
&nbsp;  8&nbsp; &nbsp; 0 sda 130767120 478199 2848404253 865895766 &#8230;<br />
&nbsp;  8&nbsp; &nbsp; 1 sda1 58 740 1598 96 2 0 4 0 0 96 96<br />
&nbsp;  8&nbsp; &nbsp; 2 sda2 4031326 3249 64502142 3693948 5273723 &#8230;<br />
&nbsp;  8&nbsp; &nbsp; 3 sda3 142 3261 4030 865 538334 302764 &#8230;<br />
&nbsp;  8&nbsp; &nbsp; 4 sda4 1 0 2 3 0 0 0 0 0 3 3<br />
&nbsp;  8&nbsp; &nbsp; 5 sda5 57717 8304 2083594 152577 2023051 &#8230;<br />
&nbsp;  8&nbsp; &nbsp; 6 sda6 3283 617 126914 18536 1965077 &#8230;<br />
&nbsp;  8&nbsp; &nbsp; 7 sda7 31 1062 1348 164 0 0 0 0 0 121 164<br />
&nbsp;  8&nbsp; &nbsp; 8 sda8 63475 1067 1170446 364557 1050986 &#8230;<br />
&nbsp;  8&nbsp; &nbsp; 9 sda9 409 1423 4454 2141 579616 2614979 &#8230;<br />
&nbsp;  8&nbsp;  10 sda10 30 352 1668 130 0 0 0 0 0 125 130<br />
&nbsp;  &#8230;&#8230;
</p></blockquote>
<p>&nbsp; &nbsp; 在实际的编程中, 有两个问题要处理, 一个是如何找出磁盘, 并将分区过滤掉, 因为Linux会同步更新磁盘分区及磁盘的数据, 如果不加区分, 数据就会不准确, 这个可以通第2列及第3列加以区分, 第二列为16的倍数的表示是磁盘而非分区, 第三列是磁盘名字, 一般的系统中磁盘都是小写的sd开头的. 对于普通的scsi磁盘, 只要找出第二列是16的倍数, 并且第三列前两个字母是&#8221;sd&#8221;的, 就表示是真正的磁盘, 比如前面的数据中, 只能取第一行. 为什么是16的倍数, 估计和一块盘最多有16个分区有关吧. </p>
<p>&nbsp; &nbsp; 磁盘中, 第四列后的都是性能数据, 各列的官方解释如下. </p>
<blockquote class="prefont"><p>
Field&nbsp; 1 &#8212; # of reads completed<br />
&nbsp; &nbsp; This is the total number of reads completed successfully.<br />
Field&nbsp; 2 &#8212; # of reads merged, field 6 &#8212; # of writes merged<br />
&nbsp; &nbsp; Reads and writes which are adjacent to each other may be merged for<br />
&nbsp; &nbsp; efficiency.&nbsp; Thus two 4K reads may become one 8K read before it is<br />
&nbsp; &nbsp; ultimately handed to the disk, and so it will be counted (and queued)<br />
&nbsp; &nbsp; as only one I/O.&nbsp; This field lets you know how often this was done.<br />
Field&nbsp; 3 &#8212; # of sectors read<br />
&nbsp; &nbsp; This is the total number of sectors read successfully.<br />
Field&nbsp; 4 &#8212; # of milliseconds spent reading<br />
&nbsp; &nbsp; This is the total number of milliseconds spent by all reads (as<br />
&nbsp; &nbsp; measured from __make_request() to end_that_request_last()).<br />
Field&nbsp; 5 &#8212; # of writes completed<br />
&nbsp; &nbsp; This is the total number of writes completed successfully.<br />
Field&nbsp; 7 &#8212; # of sectors written<br />
&nbsp; &nbsp; This is the total number of sectors written successfully.<br />
Field&nbsp; 8 &#8212; # of milliseconds spent writing<br />
&nbsp; &nbsp; This is the total number of milliseconds spent by all writes (as<br />
&nbsp; &nbsp; measured from __make_request() to end_that_request_last()).<br />
Field&nbsp; 9 &#8212; # of I/Os currently in progress<br />
&nbsp; &nbsp; The only field that should go to zero. Incremented as requests are<br />
&nbsp; &nbsp; given to appropriate struct request_queue and decremented as they finish.<br />
Field 10 &#8212; # of milliseconds spent doing I/Os<br />
&nbsp; &nbsp; This field is increases so long as field 9 is nonzero.<br />
Field 11 &#8212; weighted # of milliseconds spent doing I/Os<br />
&nbsp; &nbsp; This field is incremented at each I/O start, I/O completion, I/O<br />
&nbsp; &nbsp; merge, or read of these stats by the number of I/Os in progress<br />
&nbsp; &nbsp; (field 9) times the number of milliseconds spent doing I/O since the<br />
&nbsp; &nbsp; last update of this field.&nbsp; This can provide an easy measure of both<br />
&nbsp; &nbsp; I/O completion time and the backlog that may be accumulating.
</p></blockquote>
<p>&nbsp; &nbsp; 另一个问题, 当Linux接到存贮时, 可能会有多条通路, 形成很多的虚盘, 这时不能取虚盘的性能数据, 比如连到EMC的存贮时, 第三列的名字应当为emcpower开头, 而不是sd开头了. 在<a href="http://www.anysql.net/software/linuxmon.zip">Linuxmon程序</a>中, 可以通过disk参数, 指定磁盘的前缀名字.</p>
<blockquote class="prefont"><p>
$ linuxmon.bin disk=emcpower<br />
&#8230; Read RTim Writ WTim Busy Time<br />
&#8230;&nbsp;  70&nbsp; &nbsp; 0&nbsp;  57&nbsp; &nbsp; 0&nbsp; &nbsp; 0&nbsp;  39<br />
&#8230;&nbsp;  65&nbsp; &nbsp; 0&nbsp;  55&nbsp; &nbsp; 0&nbsp; &nbsp; 0&nbsp;  40<br />
&#8230;&nbsp; 100&nbsp; &nbsp; 0&nbsp; 162&nbsp; &nbsp; 0&nbsp; &nbsp; 0&nbsp; 112<br />
&#8230;&nbsp;  70&nbsp; &nbsp; 0&nbsp;  57&nbsp; &nbsp; 0&nbsp; &nbsp; 0&nbsp;  36<br />
&#8230;&nbsp;  65&nbsp; &nbsp; 0&nbsp;  70&nbsp; &nbsp; 0&nbsp; &nbsp; 0&nbsp;  64<br />
&#8230;&nbsp;  76&nbsp; &nbsp; 0&nbsp;  55&nbsp; &nbsp; 0&nbsp; &nbsp; 0&nbsp;  33<br />
&#8230;&nbsp; 105&nbsp; &nbsp; 2&nbsp;  98&nbsp; &nbsp; 0&nbsp; &nbsp; 0&nbsp;  74<br />
&#8230;&nbsp;  65&nbsp; &nbsp; 0&nbsp;  54&nbsp; &nbsp; 0&nbsp; &nbsp; 0&nbsp;  38<br />
&#8230;&nbsp; 155&nbsp; &nbsp; 0&nbsp; 102&nbsp; &nbsp; 0&nbsp; &nbsp; 0&nbsp;  85<br />
&#8230;&nbsp;  76&nbsp; &nbsp; 0&nbsp;  63&nbsp; &nbsp; 0&nbsp; &nbsp; 0&nbsp;  49<br />
&#8230;&nbsp;  64&nbsp; &nbsp; 0&nbsp;  54&nbsp; &nbsp; 0&nbsp; &nbsp; 0&nbsp;  38<br />
&#8230;&nbsp;  53&nbsp; &nbsp; 0&nbsp;  34&nbsp; &nbsp; 0&nbsp; &nbsp; 0&nbsp;  22
</p></blockquote>
<p>&nbsp; &nbsp; 如果上面的理解有问题, 欢迎指出来, 正在学习之中, 有理解错误也是难免的. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2010/07/14 -- <a href="http://www.anysql.net/dba/get-aix-hba-iostat.html" title="AIX下获得HBA卡的IO流量信息">AIX下获得HBA卡的IO流量信息</a> (0)</li><li>2009/11/05 -- <a href="http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html" title="oramon新增三个性能数据">oramon新增三个性能数据</a> (3)</li><li>2009/10/27 -- <a href="http://www.anysql.net/developer/simple-c-program-tuning.html" title="一次简单C程序的性能优化">一次简单C程序的性能优化</a> (5)</li><li>2009/07/09 -- <a href="http://www.anysql.net/dba/oracle-where-filter-order.html" title="SQL执行filter条件的顺序问题">SQL执行filter条件的顺序问题</a> (2)</li><li>2009/07/01 -- <a href="http://www.anysql.net/dba/partition-table-statistics-choose.html" title="分区表用哪个级别的统计信息?">分区表用哪个级别的统计信息?</a> (2)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-system-event.html" title="oramon如何收集V$SYSTEM_EVENT数据?">oramon如何收集V$SYSTEM_EVENT数据?</a> (3)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-session-history.html" title="oramon如何从V$SESSION收集性能数据?">oramon如何从V$SESSION收集性能数据?</a> (0)</li><li>2009/06/24 -- <a href="http://www.anysql.net/oracle/oramon-system-statistics.html" title="oramon如何从V$SYSSTAT收集性能数据?">oramon如何从V$SYSSTAT收集性能数据?</a> (1)</li><li>2009/05/22 -- <a href="http://www.anysql.net/dba/benefit-from-oramon-perf-alert.html" title="从oramon新报警中受益">从oramon新报警中受益</a> (1)</li><li>2009/05/21 -- <a href="http://www.anysql.net/dba/oramon-database-perf-alert.html" title="用oramon的数据进行报警">用oramon的数据进行报警</a> (3)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/dba/get-linux-iostat.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>oramon新增三个性能数据</title>
		<link>http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html</link>
		<comments>http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html#comments</comments>
		<pubDate>Thu, 05 Nov 2009 11:46:13 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Tuning]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=715</guid>
		<description><![CDATA[&#160; &#160; 自从上次加了OS的性能指标后, 已经好久没有更新oramon了, 根据最近获得的经验, 发现还是有必要加上以下三个数据: 可重用日志组数(ARCLOG), 回滚段使用(UNDO), 日志同步时长(LGFC). &#160; &#160; 可重用日志组数指数据库中已经归档, 并且状态为不活动(INACTIVE)的联机日志的组数, 可以用于监控归档速度及日志切换速度, 并根据这个数据进行报警. 回滚段使用指的是所有回滚段占用的空间的总大小, 在OLTP数据库中, 如果UNDO表空间满了, 可能会遇到Bug, 引起数据库表空间锁的争用. 日志同步时长可以用来评价日志写出去的速度, 或Oracle面临的事务压力. &#160; &#160; 下面是在笔记本上获得的数据库性能数据. www.AnySQL.net&#160; Arc Undo Lgfc 11/05-18:59:17&#160; &#160; 0&#160; 62&#160; &#160; 5 11/05-18:59:27&#160; &#160; 0&#160; 62&#160; 10 11/05-18:59:37&#160; &#160; 0&#160; 62&#160; 10 11/05-18:59:47&#160; &#160; 0&#160; 62&#160; 10 11/05-18:59:57&#160; &#160; 0&#160; 62&#160; 10 [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 自从上次加了OS的性能指标后, 已经好久没有更新oramon了, 根据最近获得的经验, 发现还是有必要加上以下三个数据: 可重用日志组数(ARCLOG), 回滚段使用(UNDO), 日志同步时长(LGFC). </p>
<p>&nbsp; &nbsp; 可重用日志组数指数据库中已经归档, 并且状态为不活动(INACTIVE)的联机日志的组数, 可以用于监控归档速度及日志切换速度, 并根据这个数据进行报警. 回滚段使用指的是所有回滚段占用的空间的总大小, 在OLTP数据库中, 如果UNDO表空间满了, 可能会遇到Bug, 引起数据库表空间锁的争用. 日志同步时长可以用来评价日志写出去的速度, 或Oracle面临的事务压力. </p>
<p>&nbsp; &nbsp; 下面是在笔记本上获得的数据库性能数据. </p>
<blockquote class="prefont"><p>
www.AnySQL.net&nbsp; Arc Undo Lgfc<br />
11/05-18:59:17&nbsp; &nbsp; 0&nbsp;  62&nbsp; &nbsp; 5<br />
11/05-18:59:27&nbsp; &nbsp; 0&nbsp;  62&nbsp;  10<br />
11/05-18:59:37&nbsp; &nbsp; 0&nbsp;  62&nbsp;  10<br />
11/05-18:59:47&nbsp; &nbsp; 0&nbsp;  62&nbsp;  10<br />
11/05-18:59:57&nbsp; &nbsp; 0&nbsp;  62&nbsp;  10<br />
11/05-19:00:07&nbsp; &nbsp; 0&nbsp;  62&nbsp;  10<br />
11/05-19:00:17&nbsp; &nbsp; 0&nbsp;  62&nbsp;  10<br />
11/05-19:00:27&nbsp; &nbsp; 0&nbsp;  62&nbsp; &nbsp; 0<br />
11/05-19:00:37&nbsp; &nbsp; 0&nbsp;  62&nbsp; &nbsp; 0<br />
11/05-19:00:47&nbsp; &nbsp; 0&nbsp;  62&nbsp; &nbsp; 0<br />
11/05-19:00:57&nbsp; &nbsp; 0&nbsp;  62&nbsp;  10
</p></blockquote>
<p>&nbsp; &nbsp; 收集了数据后, 可以根据数据轻松地增加监控点, 或者将数据显示在WebChart的图上, 以供性能或容量分析. 在真实的苛刻的环境下的应用, 会使oramon越来越成熟, 为诊断Oracle的疑难杂症提供有力的数据依据.</p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-system-event.html" title="oramon如何收集V$SYSTEM_EVENT数据?">oramon如何收集V$SYSTEM_EVENT数据?</a> (3)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-session-history.html" title="oramon如何从V$SESSION收集性能数据?">oramon如何从V$SESSION收集性能数据?</a> (0)</li><li>2009/06/24 -- <a href="http://www.anysql.net/oracle/oramon-system-statistics.html" title="oramon如何从V$SYSSTAT收集性能数据?">oramon如何从V$SYSSTAT收集性能数据?</a> (1)</li><li>2009/05/22 -- <a href="http://www.anysql.net/dba/benefit-from-oramon-perf-alert.html" title="从oramon新报警中受益">从oramon新报警中受益</a> (1)</li><li>2009/05/21 -- <a href="http://www.anysql.net/dba/oramon-database-perf-alert.html" title="用oramon的数据进行报警">用oramon的数据进行报警</a> (3)</li><li>2009/04/21 -- <a href="http://www.anysql.net/tools/display_oramon_perf_data.html" title="用图表显示oramon数据">用图表显示oramon数据</a> (7)</li><li>2009/04/15 -- <a href="http://www.anysql.net/tools/load_oramon_perf_data.html" title="装载oramon性能数据">装载oramon性能数据</a> (0)</li><li>2009/04/15 -- <a href="http://www.anysql.net/tools/install_and_start_oramon.html" title="安装与运行oramon">安装与运行oramon</a> (2)</li><li>2009/04/14 -- <a href="http://www.anysql.net/tools/oramon_gather_perf_data.html" title="oramon, 收集性能数据">oramon, 收集性能数据</a> (5)</li><li>2007/08/20 -- <a href="http://www.anysql.net/tools/oramon_running_one_week.html" title="oramon稳定运行一周">oramon稳定运行一周</a> (5)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>一次简单C程序的性能优化</title>
		<link>http://www.anysql.net/developer/simple-c-program-tuning.html</link>
		<comments>http://www.anysql.net/developer/simple-c-program-tuning.html#comments</comments>
		<pubDate>Tue, 27 Oct 2009 08:53:17 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Developer]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Tuning]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=711</guid>
		<description><![CDATA[&#160; &#160; 下面这段简单的程序, 如何优化? #include &#60;stdio.h&#62; void main () { &#160; int i; &#160; for (i=0;i&#60;20000000;i++) &#160; { &#160; &#160; &#160; printf(&#8220;%012d\n&#8221;,i); &#160; } } &#160; &#160; 下午居然想到要来优化这段程序, 并且写出了更好的程序, 性能提升了30%, 从18秒提升到了12秒. #include &#60;stdio.h&#62; typedef struct _NUMERLIST { &#160; &#160; int len; &#160; &#160; char buf[5]; } NUMBERLIST; void printNumber(int num, NUMBERLIST numlist[]) { &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 下面这段简单的程序, 如何优化?  </p>
<blockquote class="prefont"><p>
#include &lt;stdio.h&gt;</p>
<p>void main ()<br />
{<br />
&nbsp;  int i;<br />
&nbsp;  for (i=0;i&lt;20000000;i++)<br />
&nbsp;  {<br />
&nbsp; &nbsp; &nbsp;  printf(&#8220;%012d\n&#8221;,i);<br />
&nbsp;  }<br />
}
</p></blockquote>
<p>&nbsp; &nbsp; 下午居然想到要来优化这段程序, 并且写出了更好的程序, <strong>性能提升了30%, 从18秒提升到了12秒</strong>. </p>
<blockquote class="prefont"><p>
#include &lt;stdio.h&gt;</p>
<p>typedef struct _NUMERLIST<br />
{<br />
&nbsp; &nbsp; int len;<br />
&nbsp; &nbsp; char buf[5];<br />
} NUMBERLIST;</p>
<p>void printNumber(int num, NUMBERLIST numlist[])<br />
{<br />
&nbsp; &nbsp; int v_num,i,j,k,pos=0;<br />
&nbsp; &nbsp; char tmpbuf[32];<br />
&nbsp; &nbsp; memset(tmpbuf,0,32);<br />
&nbsp; &nbsp; v_num=num;<br />
&nbsp; &nbsp; for(i=3;i&gt;=0;i&#8211;)<br />
&nbsp; &nbsp; {<br />
&nbsp; v_num = num;<br />
&nbsp; for(k=0;k&lt;i;k++) v_num = v_num/1000;<br />
&nbsp; v_num = v_num % 1000;<br />
&nbsp; if (v_num &gt; 999)<br />
&nbsp; &nbsp; &nbsp; pos = pos + sprintf(tmpbuf+pos,&#8221;%03d&#8221;, v_num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; {<br />
&nbsp; &nbsp; &nbsp; memcpy(tmpbuf+pos, numlist[v_num].buf,3);<br />
&nbsp; &nbsp; &nbsp; pos = pos + 3;<br />
&nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; printf(&#8220;%s\n&#8221;, tmpbuf);<br />
}</p>
<p>void main ()<br />
{<br />
&nbsp;  NUMBERLIST numlist[1000];<br />
&nbsp;  int i;<br />
&nbsp;  for (i=0;i&lt;1000;i++)<br />
&nbsp;  {<br />
&nbsp; &nbsp; &nbsp;  sprintf(numlist[i].buf, &#8220;%03d&#8221;, i);<br />
&nbsp;  }<br />
&nbsp;  for (i=0;i&lt;20000000;i++)<br />
&nbsp;  {<br />
&nbsp; &nbsp; &nbsp;  printNumber(i, numlist);<br />
&nbsp;  }<br />
}
</p></blockquote>
<p>&nbsp; &nbsp; 如果优化一下两个程序的IO, 采用缓冲输出, 估计第二段程序更显优势. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2010/07/14 -- <a href="http://www.anysql.net/dba/get-aix-hba-iostat.html" title="AIX下获得HBA卡的IO流量信息">AIX下获得HBA卡的IO流量信息</a> (0)</li><li>2010/06/18 -- <a href="http://www.anysql.net/dba/get-linux-iostat.html" title="Linux下获取IO压力数据">Linux下获取IO压力数据</a> (4)</li><li>2010/04/19 -- <a href="http://www.anysql.net/developer/sqluldr2-windows-sdk-released.html" title="发布SQLULDR2 Windows SDK">发布SQLULDR2 Windows SDK</a> (2)</li><li>2009/11/05 -- <a href="http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html" title="oramon新增三个性能数据">oramon新增三个性能数据</a> (3)</li><li>2009/07/09 -- <a href="http://www.anysql.net/dba/oracle-where-filter-order.html" title="SQL执行filter条件的顺序问题">SQL执行filter条件的顺序问题</a> (2)</li><li>2009/07/01 -- <a href="http://www.anysql.net/dba/partition-table-statistics-choose.html" title="分区表用哪个级别的统计信息?">分区表用哪个级别的统计信息?</a> (2)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-system-event.html" title="oramon如何收集V$SYSTEM_EVENT数据?">oramon如何收集V$SYSTEM_EVENT数据?</a> (3)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-session-history.html" title="oramon如何从V$SESSION收集性能数据?">oramon如何从V$SESSION收集性能数据?</a> (0)</li><li>2009/06/24 -- <a href="http://www.anysql.net/oracle/oramon-system-statistics.html" title="oramon如何从V$SYSSTAT收集性能数据?">oramon如何从V$SYSSTAT收集性能数据?</a> (1)</li><li>2009/05/22 -- <a href="http://www.anysql.net/dba/benefit-from-oramon-perf-alert.html" title="从oramon新报警中受益">从oramon新报警中受益</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/developer/simple-c-program-tuning.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SQL执行filter条件的顺序问题</title>
		<link>http://www.anysql.net/dba/oracle-where-filter-order.html</link>
		<comments>http://www.anysql.net/dba/oracle-where-filter-order.html#comments</comments>
		<pubDate>Thu, 09 Jul 2009 03:01:27 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tuning]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=681</guid>
		<description><![CDATA[&#160; &#160; SQL中不可能让Where中的所有条件都走上索引, 不能走索引的部份条件就成了表上的filter条件, 在极端情况下, filter的顺序问题会影响SQL的执行结果. 例如我们建立这样一个表, 并输入两条数据. create table TEST_FILTER ( &#160; &#160; COL1 NUMBER(10) NOT NULL, &#160; &#160; COL2 VARCHAR2(10) NOT NULL ); INSERT INTO TEST_FILTER VALUES (1,&#8217;A'); INSERT INTO TEST_FILTER VALUES (2,&#8217;9&#8242;); &#160; &#160; 然后分别在不同的优化器版本(可通过修改会话级optimizer features enable参数)下执行如下SQL语句, 会发现10g下这两个SQL都能返回正确的结果, 而在9i下, 第一个SQL会报不合法的数字(Invalid Number)的错误. SELECT * FROM TEST_FILTER &#160; &#160; WHERE COL1=2 AND TO_NUMBER(COL2) &#60; [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; SQL中不可能让Where中的所有条件都走上索引, 不能走索引的部份条件就成了表上的filter条件, 在极端情况下, filter的顺序问题会影响SQL的执行结果. 例如我们建立这样一个表, 并输入两条数据. </p>
<blockquote class="prefont"><p>
create table TEST_FILTER<br />
(<br />
&nbsp; &nbsp;  COL1 NUMBER(10) NOT NULL,<br />
&nbsp; &nbsp;  COL2 VARCHAR2(10) NOT NULL<br />
);<br />
INSERT INTO TEST_FILTER VALUES (1,&#8217;A');<br />
INSERT INTO TEST_FILTER VALUES (2,&#8217;9&#8242;);
</p></blockquote>
<p>&nbsp; &nbsp; 然后分别在不同的优化器版本(可通过修改会话级optimizer features enable参数)下执行如下SQL语句, 会发现10g下这两个SQL都能返回正确的结果, 而在9i下, 第一个SQL会报不合法的数字(Invalid Number)的错误. </p>
<blockquote class="prefont"><p>
SELECT * FROM TEST_FILTER <br />
&nbsp; &nbsp; WHERE COL1=2 AND TO_NUMBER(COL2) &lt; 100;<br />
SELECT * FROM TEST_FILTER <br />
&nbsp; &nbsp; WHERE TO_NUMBER(COL2) &lt; 100 AND COL1=2;
</p></blockquote>
<p>&nbsp; &nbsp; 观察一下两个SQL语句的执行计划, 区别只在于filter中的顺序问题. </p>
<blockquote class="prefont"><p>
filter(TO_NUMBER(&#8220;COL2&#8243;)&lt;100 AND &#8220;COL1&#8243;=2)<br />
filter(&#8220;COL1&#8243;=2 AND TO_NUMBER(&#8220;COL2&#8243;)&lt;100)
</p></blockquote>
<p>&nbsp; &nbsp; 当出现第一个filter顺序时, SQL执行就出错了, 而在第二个时, SQL就能正确执行. Oracle 9i中filter的顺序会按从右到左执行, 而在10g中会先执行没有函数转换的过滤条件. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2008/07/11 -- <a href="http://www.anysql.net/dba/tuning_work_logic.html" title="Step XX Done, Next XX.sql">Step XX Done, Next XX.sql</a> (1)</li><li>2008/07/11 -- <a href="http://www.anysql.net/dba/oracle_tuning_sequence.html" title="节约数据迁移??分钟">节约数据迁移??分钟</a> (5)</li><li>2008/07/10 -- <a href="http://www.anysql.net/dba/fast_recover_100_tables.html" title="节约数据迁移15分钟">节约数据迁移15分钟</a> (2)</li><li>2008/06/25 -- <a href="http://www.anysql.net/dba/search_sql_by_tablename.html" title="优化一条UPDATE语句">优化一条UPDATE语句</a> (4)</li><li>2008/01/15 -- <a href="http://www.anysql.net/dba/after_analyze_whole_schema.html" title="分析用户所有表之后">分析用户所有表之后</a> (5)</li><li>2007/07/11 -- <a href="http://www.anysql.net/dba/dba_sql_tuning03.html" title="通过改写SQL来优化性能, 如何做?">通过改写SQL来优化性能, 如何做?</a> (3)</li><li>2007/06/06 -- <a href="http://www.anysql.net/dba/index_vs_table_filter.html" title="OR引起的性能问题, 在表上进行行过滤">OR引起的性能问题, 在表上进行行过滤</a> (4)</li><li>2010/07/14 -- <a href="http://www.anysql.net/dba/get-aix-hba-iostat.html" title="AIX下获得HBA卡的IO流量信息">AIX下获得HBA卡的IO流量信息</a> (0)</li><li>2009/11/05 -- <a href="http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html" title="oramon新增三个性能数据">oramon新增三个性能数据</a> (3)</li><li>2009/07/01 -- <a href="http://www.anysql.net/dba/partition-table-statistics-choose.html" title="分区表用哪个级别的统计信息?">分区表用哪个级别的统计信息?</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/dba/oracle-where-filter-order.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>分区表用哪个级别的统计信息?</title>
		<link>http://www.anysql.net/dba/partition-table-statistics-choose.html</link>
		<comments>http://www.anysql.net/dba/partition-table-statistics-choose.html#comments</comments>
		<pubDate>Tue, 30 Jun 2009 16:09:45 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Partition]]></category>
		<category><![CDATA[Table]]></category>
		<category><![CDATA[Tuning]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=678</guid>
		<description><![CDATA[&#160; &#160; 这几天有几个分区表上的SQL执行计划不正常, 感觉上不应当, 已经设置了几个容易引起优化器选错执行计划的参数了. ALTER SYSTEM SET OPTIMIZER_DYNAMIC_SAMPLING=0; ALTER SYSTEM SET &#8220;_optim_peek_user_binds&#8221;=false; &#160; &#160; 按照现行的表分析原则, 只统计了表的全局索引, 不统计表分区上的索引, 因为分区会有增减操作, 不是每个分区都有数据, 也没有定下来要经常分析表, 而是分析后如果不出问题就不再分析. 现在SQL走错了, 可能的原因有什么呢? 重新分析一下不行, 看了一下执行计划, 发现全表扫描的COST值很底, 估计是用了分区上的统计信息了, 于是手动将全局的统计信息复制到每一个分区上得以解决. &#160; &#160; 为了得到原因, 回顾了一下当时的SQL, 发现有一个特征, 就是出问题的SQL都能定位到某个分区或某些分区, 今天就模拟了一下情况, 先只有全局统计信息. 首先用分区列范围查询, 去试了一下, 发现用的是分区级的统计信息. SQL&#62; select * from database_perf_statistics &#160; 2&#160; where day &#62; sysdate &#8211; 100 and day [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 这几天有几个分区表上的SQL执行计划不正常, 感觉上不应当, 已经设置了几个容易引起优化器选错执行计划的参数了. </p>
<blockquote class="prefont"><p>
ALTER SYSTEM SET OPTIMIZER_DYNAMIC_SAMPLING=0;<br />
ALTER SYSTEM SET &#8220;_optim_peek_user_binds&#8221;=false;
</p></blockquote>
<p>&nbsp; &nbsp; 按照现行的表分析原则, 只统计了表的全局索引, 不统计表分区上的索引, 因为分区会有增减操作, 不是每个分区都有数据, 也没有定下来要经常分析表, 而是分析后如果不出问题就不再分析. 现在SQL走错了, 可能的原因有什么呢? 重新分析一下不行, 看了一下执行计划, 发现全表扫描的COST值很底, 估计是用了分区上的统计信息了, 于是手动将全局的统计信息复制到每一个分区上得以解决. </p>
<p>&nbsp; &nbsp; 为了得到原因, 回顾了一下当时的SQL, 发现有一个特征, 就是出问题的SQL都能定位到某个分区或某些分区, 今天就模拟了一下情况, 先只有全局统计信息. 首先用分区列范围查询, 去试了一下, 发现用的是分区级的统计信息. </p>
<blockquote class="prefont"><p>
SQL&gt; select * from database_perf_statistics <br />
&nbsp; 2&nbsp; where day &gt; sysdate &#8211; 100 and day &lt; sysdate + 300;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
| Id&nbsp; | Operation&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| Cost (%CPU)| Pstart| Pstop |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
|&nbsp; &nbsp;0 | SELECT STATEMENT&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp;3&nbsp; &nbsp;(0)|&nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp;|<br />
|*&nbsp; 1 |&nbsp; FILTER&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp;|<br />
|&nbsp; &nbsp;2 |&nbsp; &nbsp;PARTITION RANGE ITERATOR|&nbsp; &nbsp; &nbsp;3&nbsp; &nbsp;(0)|&nbsp; &nbsp;KEY |&nbsp; &nbsp;KEY |<br />
|*&nbsp; 3 |&nbsp; &nbsp; TABLE ACCESS FULL&nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp;3&nbsp; &nbsp;(0)|&nbsp; &nbsp;KEY |&nbsp; &nbsp;KEY |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
</p></blockquote>
<p>&nbsp; &nbsp; 然后全表扫描, 涉及所有的分区时, 用的是全局的统计信息. </p>
<blockquote class="prefont"><p>
SQL&gt; select * from database_perf_statistics;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
| Id&nbsp; | Operation&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| Cost (%CPU)| Pstart| Pstop |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
|&nbsp; &nbsp;0 | SELECT STATEMENT&nbsp; &nbsp; |&nbsp; 2196&nbsp; &nbsp;(1)|&nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp;|<br />
|&nbsp; &nbsp;1 |&nbsp; PARTITION RANGE ALL|&nbsp; 2196&nbsp; &nbsp;(1)|&nbsp; &nbsp; &nbsp;1 |&nbsp; &nbsp; &nbsp;4 |<br />
|&nbsp; &nbsp;2 |&nbsp; &nbsp;TABLE ACCESS FULL |&nbsp; 2196&nbsp; &nbsp;(1)|&nbsp; &nbsp; &nbsp;1 |&nbsp; &nbsp; &nbsp;4 |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
</p></blockquote>
<p>&nbsp; &nbsp; 再测试一个开包的查询条件, 发现用的也是分区的统计信息. </p>
<blockquote class="prefont"><p>
SQL&gt; select * from database_perf_statistics where day &gt; sysdate &#8211; 100;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| Id&nbsp; | Operation&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | Cost (%CPU)| Pstart| Pstop |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
|&nbsp; &nbsp;0 | SELECT STATEMENT&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp;3&nbsp; &nbsp;(0)|&nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp;|<br />
|&nbsp; &nbsp;1 |&nbsp; PARTITION RANGE ITERATOR|&nbsp; &nbsp; &nbsp;3&nbsp; &nbsp;(0)|&nbsp; &nbsp;KEY |&nbsp; &nbsp; &nbsp;4 |<br />
|*&nbsp; 2 |&nbsp; &nbsp;TABLE ACCESS FULL&nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp;3&nbsp; &nbsp;(0)|&nbsp; &nbsp;KEY |&nbsp; &nbsp; &nbsp;4 |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;
</p></blockquote>
<p>&nbsp; &nbsp; 重新设置了一下各分区的统计信息, 再验证一下上面的SQL的COST值, 就确定了是这个原因引起的, 需要更改一下我们的分析策略了. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2010/07/14 -- <a href="http://www.anysql.net/dba/get-aix-hba-iostat.html" title="AIX下获得HBA卡的IO流量信息">AIX下获得HBA卡的IO流量信息</a> (0)</li><li>2009/11/05 -- <a href="http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html" title="oramon新增三个性能数据">oramon新增三个性能数据</a> (3)</li><li>2009/07/09 -- <a href="http://www.anysql.net/dba/oracle-where-filter-order.html" title="SQL执行filter条件的顺序问题">SQL执行filter条件的顺序问题</a> (2)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-system-event.html" title="oramon如何收集V$SYSTEM_EVENT数据?">oramon如何收集V$SYSTEM_EVENT数据?</a> (3)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-session-history.html" title="oramon如何从V$SESSION收集性能数据?">oramon如何从V$SESSION收集性能数据?</a> (0)</li><li>2009/06/24 -- <a href="http://www.anysql.net/oracle/oramon-system-statistics.html" title="oramon如何从V$SYSSTAT收集性能数据?">oramon如何从V$SYSSTAT收集性能数据?</a> (1)</li><li>2009/05/22 -- <a href="http://www.anysql.net/dba/benefit-from-oramon-perf-alert.html" title="从oramon新报警中受益">从oramon新报警中受益</a> (1)</li><li>2009/05/21 -- <a href="http://www.anysql.net/dba/oramon-database-perf-alert.html" title="用oramon的数据进行报警">用oramon的数据进行报警</a> (3)</li><li>2009/05/19 -- <a href="http://www.anysql.net/tools/deploy_new_oramon_version.html" title="新版oramon正式上线">新版oramon正式上线</a> (4)</li><li>2009/05/08 -- <a href="http://www.anysql.net/dba/analyze_perf_data_two.html" title="分析性能数据之二">分析性能数据之二</a> (5)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/dba/partition-table-statistics-choose.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>oramon如何收集V$SYSTEM_EVENT数据?</title>
		<link>http://www.anysql.net/tools/oramon-system-event.html</link>
		<comments>http://www.anysql.net/tools/oramon-system-event.html#comments</comments>
		<pubDate>Thu, 25 Jun 2009 07:45:29 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Tuning]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=675</guid>
		<description><![CDATA[&#160; &#160; 基于等待事件的性能调优方法, 自从提出来后就一直很管用, 很快就替换掉了根据命中率来调优的老方法. 当然oramon也同样关于等待事件的数据, 同样以10秒钟的频率计算出10秒内发生的等待事件数据, 并用如下格式保存. 06/25-15:23:44 206-49792:416125:83, 203-18279:89351:48, 157-8436:47502:56, 21-153:1438:93, 4-397:1360:34, 195-10382:906:0, 209-128:726:56, 210-26:514:197, 372-1409:24:0, 233-111:15:1, 207-1:10:100, 234-50:0:0, 152-2:0:0, 06/25-15:23:54 206-49756:414376:83, 203-18221:90461:49, 157-10301:52368:50, 4-448:1543:34, 209-161:1007:62, 21-180:973:54, 195-10376:926:0, 210-36:566:157, 372-1343:21:0, 207-2:13:65, 233-61:0:0, 234-50:0:0, 152-3:0:0, &#160; &#160; 每一个时间点一行, 按总等待时间降序排列各个事件的数据, 单个事件的格式为&#8221;事件号-等待次数:等待时间:平均时长&#8221;, 需要注意的是平均时长的单位是万分之一秒, 而不是千分之一秒(毫秒). 可以从目标库(不同版本会有差异)中根据事件号来查询等待事件名称. SQL&#62; select name from v$event_name where event#=206; NAME &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; db file [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 基于等待事件的性能调优方法, 自从提出来后就一直很管用, 很快就替换掉了根据命中率来调优的老方法. 当然oramon也同样关于等待事件的数据, 同样以10秒钟的频率计算出10秒内发生的等待事件数据, 并用如下格式保存. </p>
<blockquote class="prefont"><p>
06/25-15:23:44 206-49792:416125:83, 203-18279:89351:48, 157-8436:47502:56, 21-153:1438:93, 4-397:1360:34, 195-10382:906:0, 209-128:726:56, 210-26:514:197, 372-1409:24:0, 233-111:15:1, 207-1:10:100, 234-50:0:0, 152-2:0:0,<br />
06/25-15:23:54 206-49756:414376:83, 203-18221:90461:49, 157-10301:52368:50, 4-448:1543:34, 209-161:1007:62, 21-180:973:54, 195-10376:926:0, 210-36:566:157, 372-1343:21:0, 207-2:13:65, 233-61:0:0, 234-50:0:0, 152-3:0:0,
</p></blockquote>
<p>&nbsp; &nbsp; 每一个时间点一行, 按总等待时间降序排列各个事件的数据, 单个事件的格式为&#8221;事件号-等待次数:等待时间:平均时长&#8221;, 需要注意的是平均时长的单位是万分之一秒, 而不是千分之一秒(毫秒). 可以从目标库(不同版本会有差异)中根据事件号来查询等待事件名称. </p>
<blockquote class="prefont"><p>
SQL&gt; select name from v$event_name where event#=206;</p>
<p>NAME<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
db file sequential read
</p></blockquote>
<p>&nbsp; &nbsp; 象上面的例子中, 可以看到平均单块读的时间为8毫秒, 这个值可以用来评价OLTP系统的存贮响应时间. 利用10秒钟的等待事件数据, 帮我们发现了Oracle中超长log file sync等待的问题, 并成功绕过这个Bug, 有利于保持数据库系统的稳定运行. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-session-history.html" title="oramon如何从V$SESSION收集性能数据?">oramon如何从V$SESSION收集性能数据?</a> (0)</li><li>2009/06/24 -- <a href="http://www.anysql.net/oracle/oramon-system-statistics.html" title="oramon如何从V$SYSSTAT收集性能数据?">oramon如何从V$SYSSTAT收集性能数据?</a> (1)</li><li>2009/05/21 -- <a href="http://www.anysql.net/dba/oramon-database-perf-alert.html" title="用oramon的数据进行报警">用oramon的数据进行报警</a> (3)</li><li>2007/08/20 -- <a href="http://www.anysql.net/tools/oramon_running_one_week.html" title="oramon稳定运行一周">oramon稳定运行一周</a> (5)</li><li>2009/11/05 -- <a href="http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html" title="oramon新增三个性能数据">oramon新增三个性能数据</a> (3)</li><li>2009/05/22 -- <a href="http://www.anysql.net/dba/benefit-from-oramon-perf-alert.html" title="从oramon新报警中受益">从oramon新报警中受益</a> (1)</li><li>2009/04/21 -- <a href="http://www.anysql.net/tools/display_oramon_perf_data.html" title="用图表显示oramon数据">用图表显示oramon数据</a> (7)</li><li>2009/04/15 -- <a href="http://www.anysql.net/tools/load_oramon_perf_data.html" title="装载oramon性能数据">装载oramon性能数据</a> (0)</li><li>2009/04/15 -- <a href="http://www.anysql.net/tools/install_and_start_oramon.html" title="安装与运行oramon">安装与运行oramon</a> (2)</li><li>2009/04/14 -- <a href="http://www.anysql.net/tools/oramon_gather_perf_data.html" title="oramon, 收集性能数据">oramon, 收集性能数据</a> (5)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/oramon-system-event.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>oramon如何从V$SESSION收集性能数据?</title>
		<link>http://www.anysql.net/tools/oramon-session-history.html</link>
		<comments>http://www.anysql.net/tools/oramon-session-history.html#comments</comments>
		<pubDate>Thu, 25 Jun 2009 05:23:12 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Tuning]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=674</guid>
		<description><![CDATA[&#160; &#160; 当我们真正遇到数据库的负载问题时, 一般都会有大量的活动会话，处理执行或是处于等待状态, 要解决问题或找出问题的根源, 就要知道那时这些活动会话在做些什到或等待什么? 在Oracle 10g中我们可以查询V$SESSION获得这些信息, 在Oracle 9i及更早的版本中, 则需要将V$SESSION和V$SESSION_WAIT关联起来. &#160; &#160; oramon中就记录了这些信息, 记录的数据如下, 格式为&#8221;事件号:SQL Hash Value-会话数&#8221;. 表示在某个时间点有多少个会话在执行这个SQL, 这些会话处理什么样的等待状态. &#8230;&#8230; 10/30-20:02:37&#160;&#160;205:2815233029:1, 372:4160993935:1 10/30-20:02:47&#160;&#160;205:1623840268:1, 372:1569451005:1, 372:4160993935:1 10/30-20:02:57&#160;&#160;205:374916427:1, 372:3179818757:1, 372:4160993935:1 10/30-20:03:07&#160;&#160;205:1623840268:1, 372:860679981:1, 372:4160993935:1 10/30-20:03:17&#160;&#160;372:4160993935:1 10/30-20:03:27&#160;&#160;372:270817213:1, 372:4160993935:1 10/30-20:03:37&#160;&#160;372:4160993935:1 &#8230;&#8230; &#160; &#160; oramon每10秒执行一次查询并记录数据, 因此遇到问题时, 可以用记录的数据进行跟踪分析, 或进行事后分析. 为解决突发类的负载问题, 提供了有力的数据支持, 从我的经验中, 这些信息是非常有用的, 帮我找出了很多性能问题的根本原因, 从而切实解决了很多的问题. Relative Posts:2009/06/25 -- oramon如何收集V$SYSTEM_EVENT数据? (3)2009/06/24 -- [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 当我们真正遇到数据库的负载问题时, 一般都会有大量的活动会话，处理执行或是处于等待状态, 要解决问题或找出问题的根源, 就要知道那时这些活动会话在做些什到或等待什么? 在Oracle 10g中我们可以查询V$SESSION获得这些信息, 在Oracle 9i及更早的版本中, 则需要将V$SESSION和V$SESSION_WAIT关联起来. </p>
<p>&nbsp; &nbsp; oramon中就记录了这些信息, 记录的数据如下, 格式为&#8221;事件号:SQL Hash Value-会话数&#8221;. 表示在某个时间点有多少个会话在执行这个SQL, 这些会话处理什么样的等待状态.</p>
<blockquote class="prefont"><p>
&#8230;&#8230;<br />
10/30-20:02:37&nbsp;&nbsp;205:2815233029:1, 372:4160993935:1<br />
10/30-20:02:47&nbsp;&nbsp;205:1623840268:1, 372:1569451005:1, 372:4160993935:1<br />
10/30-20:02:57&nbsp;&nbsp;205:374916427:1, 372:3179818757:1, 372:4160993935:1<br />
10/30-20:03:07&nbsp;&nbsp;205:1623840268:1, 372:860679981:1, 372:4160993935:1<br />
10/30-20:03:17&nbsp;&nbsp;372:4160993935:1<br />
10/30-20:03:27&nbsp;&nbsp;372:270817213:1, 372:4160993935:1<br />
10/30-20:03:37&nbsp;&nbsp;372:4160993935:1<br />
&#8230;&#8230;
</p></blockquote>
<p>&nbsp; &nbsp; oramon每10秒执行一次查询并记录数据, 因此遇到问题时, 可以用记录的数据进行跟踪分析, 或进行事后分析. 为解决突发类的负载问题, 提供了有力的数据支持, 从我的经验中, 这些信息是非常有用的, 帮我找出了很多性能问题的根本原因, 从而切实解决了很多的问题. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-system-event.html" title="oramon如何收集V$SYSTEM_EVENT数据?">oramon如何收集V$SYSTEM_EVENT数据?</a> (3)</li><li>2009/06/24 -- <a href="http://www.anysql.net/oracle/oramon-system-statistics.html" title="oramon如何从V$SYSSTAT收集性能数据?">oramon如何从V$SYSSTAT收集性能数据?</a> (1)</li><li>2009/05/21 -- <a href="http://www.anysql.net/dba/oramon-database-perf-alert.html" title="用oramon的数据进行报警">用oramon的数据进行报警</a> (3)</li><li>2007/08/20 -- <a href="http://www.anysql.net/tools/oramon_running_one_week.html" title="oramon稳定运行一周">oramon稳定运行一周</a> (5)</li><li>2009/11/05 -- <a href="http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html" title="oramon新增三个性能数据">oramon新增三个性能数据</a> (3)</li><li>2009/05/22 -- <a href="http://www.anysql.net/dba/benefit-from-oramon-perf-alert.html" title="从oramon新报警中受益">从oramon新报警中受益</a> (1)</li><li>2009/04/21 -- <a href="http://www.anysql.net/tools/display_oramon_perf_data.html" title="用图表显示oramon数据">用图表显示oramon数据</a> (7)</li><li>2009/04/15 -- <a href="http://www.anysql.net/tools/load_oramon_perf_data.html" title="装载oramon性能数据">装载oramon性能数据</a> (0)</li><li>2009/04/15 -- <a href="http://www.anysql.net/tools/install_and_start_oramon.html" title="安装与运行oramon">安装与运行oramon</a> (2)</li><li>2009/04/14 -- <a href="http://www.anysql.net/tools/oramon_gather_perf_data.html" title="oramon, 收集性能数据">oramon, 收集性能数据</a> (5)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/oramon-session-history.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>oramon如何从V$SYSSTAT收集性能数据?</title>
		<link>http://www.anysql.net/oracle/oramon-system-statistics.html</link>
		<comments>http://www.anysql.net/oracle/oramon-system-statistics.html#comments</comments>
		<pubDate>Wed, 24 Jun 2009 00:09:10 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tuning]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=671</guid>
		<description><![CDATA[&#160; &#160; Oracle系统级的性能统计数据对于解决性能问题十分有用, 因此在8, 8i, 9i, 10g, 11g的发展过程中, 性能统计项一直在不断增加. 要充分发挥这些数据的作用, 关键是如何展示这些性能数据, 以利于性能问题分析, 例如关于Oracle中物理读的一些统计值. SQL&#62; SELECT name, value FROM V$SYSSTAT WHERE STATISTIC# IN (54,120,56); NAME&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;VALUE &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;- physical reads&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2373 physical reads direct&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;39 physical reads direct (lob)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 &#160; &#160; 如果只看绝对值, 是没有多少作用的, 从中看不到什么有用的信息. 20:10:24 SQL&#62; select name,value from v$sysstat where statistic#=54; NAME&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;VALUE &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;- physical reads&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; Oracle系统级的性能统计数据对于解决性能问题十分有用, 因此在8, 8i, 9i, 10g, 11g的发展过程中, 性能统计项一直在不断增加. 要充分发挥这些数据的作用, 关键是如何展示这些性能数据, 以利于性能问题分析, 例如关于Oracle中物理读的一些统计值. </p>
<blockquote class="prefont"><p>
SQL&gt; SELECT name, value FROM V$SYSSTAT WHERE STATISTIC# IN (54,120,56);</p>
<p>NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VALUE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;-<br />
physical reads&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2373<br />
physical reads direct&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;39<br />
physical reads direct (lob)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0
</p></blockquote>
<p>&nbsp; &nbsp; 如果只看绝对值, 是没有多少作用的, 从中看不到什么有用的信息. </p>
<blockquote class="prefont"><p>
20:10:24 SQL&gt; select name,value from v$sysstat where statistic#=54;</p>
<p>NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VALUE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;-<br />
physical reads&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3340</p>
<p>&#8230;&#8230;</p>
<p>20:10:36 SQL&gt; select name,value from v$sysstat where statistic#=54;</p>
<p>NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VALUE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;-<br />
physical reads&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6371
</p></blockquote>
<p>&nbsp; &nbsp; 执行两次, 差值(6371 &#8211; 3340 = 3031)表示Oracle在两次收集的12秒时间(20:10:24 to 20:10:36)内总共从磁盘上读取了3031个数据块, 平均每秒钟303个块, 就很好地告诉了我们数据库的物理IO压力情况. 用oramon可以将不同的性能指标数据和时间显示成二维矩阵, 方便我们查看和分析问题. </p>
<blockquote class="prefont"><p>
www.AnySQL.net Exec BGets RReq Read Writ Redo &#8230;<br />
11/27-20:15:47&nbsp;&nbsp; 54&nbsp;&nbsp; 206&nbsp;&nbsp; 15&nbsp;&nbsp; 15&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0 &#8230;<br />
11/27-20:15:57&nbsp;&nbsp;196&nbsp;&nbsp; 718&nbsp;&nbsp; 41&nbsp;&nbsp; 41&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;664 &#8230;<br />
11/27-20:16:07&nbsp;&nbsp; 64&nbsp;&nbsp; 637&nbsp;&nbsp; 19&nbsp;&nbsp; 61&nbsp;&nbsp;&nbsp;&nbsp;0 6192 &#8230;<br />
11/27-20:16:17&nbsp;&nbsp; 17&nbsp;&nbsp;&nbsp;&nbsp;16&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0 &#8230;<br />
11/27-20:16:27&nbsp;&nbsp; 17&nbsp;&nbsp;&nbsp;&nbsp;13&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0 &#8230;<br />
11/27-20:16:37&nbsp;&nbsp; 16&nbsp;&nbsp;&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0 &#8230;
</p></blockquote>
<p>&nbsp; &nbsp; 用oramon工具可以较高频率(10秒一次)来收集数据, 更容易抓取瞬间的数据负载变化, 通过分析这段时间的各个性能数据, 如: Exec=执行次数, BGets=逻辑读, RReq=读请求, Read=特理读, Writ=物理写, Redo=日志量, 等等, 便可以知道负载升高的精确原因, 从而去采取有效措辞.</p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-system-event.html" title="oramon如何收集V$SYSTEM_EVENT数据?">oramon如何收集V$SYSTEM_EVENT数据?</a> (3)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-session-history.html" title="oramon如何从V$SESSION收集性能数据?">oramon如何从V$SESSION收集性能数据?</a> (0)</li><li>2009/05/21 -- <a href="http://www.anysql.net/dba/oramon-database-perf-alert.html" title="用oramon的数据进行报警">用oramon的数据进行报警</a> (3)</li><li>2007/08/20 -- <a href="http://www.anysql.net/tools/oramon_running_one_week.html" title="oramon稳定运行一周">oramon稳定运行一周</a> (5)</li><li>2009/11/05 -- <a href="http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html" title="oramon新增三个性能数据">oramon新增三个性能数据</a> (3)</li><li>2009/05/22 -- <a href="http://www.anysql.net/dba/benefit-from-oramon-perf-alert.html" title="从oramon新报警中受益">从oramon新报警中受益</a> (1)</li><li>2009/04/21 -- <a href="http://www.anysql.net/tools/display_oramon_perf_data.html" title="用图表显示oramon数据">用图表显示oramon数据</a> (7)</li><li>2009/04/15 -- <a href="http://www.anysql.net/tools/load_oramon_perf_data.html" title="装载oramon性能数据">装载oramon性能数据</a> (0)</li><li>2009/04/15 -- <a href="http://www.anysql.net/tools/install_and_start_oramon.html" title="安装与运行oramon">安装与运行oramon</a> (2)</li><li>2009/04/14 -- <a href="http://www.anysql.net/tools/oramon_gather_perf_data.html" title="oramon, 收集性能数据">oramon, 收集性能数据</a> (5)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/oracle/oramon-system-statistics.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>从oramon新报警中受益</title>
		<link>http://www.anysql.net/dba/benefit-from-oramon-perf-alert.html</link>
		<comments>http://www.anysql.net/dba/benefit-from-oramon-perf-alert.html#comments</comments>
		<pubDate>Fri, 22 May 2009 15:38:57 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tuning]]></category>

		<guid isPermaLink="false">http://www.anysql.net/wordpress/uncategorized/%e4%bb%8eoramon%e6%96%b0%e6%8a%a5%e8%ad%a6%e4%b8%ad%e5%8f%97%e7%9b%8a.html</guid>
		<description><![CDATA[&#160; &#160; 依据oramon的数据进行报警, 相比以前仅有的Load Average和Active Session(上个oramon版本)的报警, 报警点更多了, 原来担心会有太多的报警扰乱DBA的生活. 但从过去的两天报警的真实情况来统计, 基本没有误报, 而是真实地发现了更多应当值得注意的问题. &#160; &#160; 有了更多的性能数据后, 报警的内容更多了, 从最早只有Nagios的Load Average报警, 如下所示: WARNING &#8211; load average: 9.03, 5.70, 4.36 &#160; &#160; 到老版本的oramon, 新增了Active session的信息, 如下所示: High Active Session on xxxxxx, 05/21-10:41:01 Load 2.73, Act: 45, Enq: 0 &#160; &#160; 在最新的oramon版本时, 增加了更多的性能数据, 如下所示: High Load on xxxxxx, 2009.05.21 10:41:01 Load [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 依据oramon的数据进行报警, 相比以前仅有的Load Average和Active Session(上个oramon版本)的报警, 报警点更多了, 原来担心会有太多的报警扰乱DBA的生活. 但从过去的两天报警的真实情况来统计, 基本没有误报, 而是真实地发现了更多应当值得注意的问题.</p>
<p>&nbsp; &nbsp; 有了更多的性能数据后, 报警的内容更多了, 从最早只有Nagios的Load Average报警, 如下所示: </p>
<blockquote class="prefont"><p>
WARNING &#8211; load average: 9.03, 5.70, 4.36
</p></blockquote>
<p>&nbsp; &nbsp; 到老版本的oramon, 新增了Active session的信息, 如下所示: </p>
<blockquote class="prefont"><p>
High Active Session on xxxxxx, <br />
05/21-10:41:01 Load 2.73, Act: 45, Enq: 0
</p></blockquote>
<p>&nbsp; &nbsp; 在最新的oramon版本时, 增加了更多的性能数据, 如下所示: </p>
<blockquote class="prefont"><p>
High Load on xxxxxx, 2009.05.21 10:41:01 <br />
Load 2.73, CPU:7/29/19 Swap: 1, Act: 45, Enq: 29, PQ: 0
</p></blockquote>
<p>&nbsp; &nbsp; 昨天因为Enq值过高报的警, 让我们提早注意到了应用程序中并发更新的问题, 在用户数及业务量飞速增长的情况下, 这方面要提前进行逻辑优化. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2009/11/05 -- <a href="http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html" title="oramon新增三个性能数据">oramon新增三个性能数据</a> (3)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-system-event.html" title="oramon如何收集V$SYSTEM_EVENT数据?">oramon如何收集V$SYSTEM_EVENT数据?</a> (3)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-session-history.html" title="oramon如何从V$SESSION收集性能数据?">oramon如何从V$SESSION收集性能数据?</a> (0)</li><li>2009/06/24 -- <a href="http://www.anysql.net/oracle/oramon-system-statistics.html" title="oramon如何从V$SYSSTAT收集性能数据?">oramon如何从V$SYSSTAT收集性能数据?</a> (1)</li><li>2009/05/21 -- <a href="http://www.anysql.net/dba/oramon-database-perf-alert.html" title="用oramon的数据进行报警">用oramon的数据进行报警</a> (3)</li><li>2009/04/21 -- <a href="http://www.anysql.net/tools/display_oramon_perf_data.html" title="用图表显示oramon数据">用图表显示oramon数据</a> (7)</li><li>2009/04/15 -- <a href="http://www.anysql.net/tools/load_oramon_perf_data.html" title="装载oramon性能数据">装载oramon性能数据</a> (0)</li><li>2009/04/15 -- <a href="http://www.anysql.net/tools/install_and_start_oramon.html" title="安装与运行oramon">安装与运行oramon</a> (2)</li><li>2009/04/14 -- <a href="http://www.anysql.net/tools/oramon_gather_perf_data.html" title="oramon, 收集性能数据">oramon, 收集性能数据</a> (5)</li><li>2007/08/20 -- <a href="http://www.anysql.net/tools/oramon_running_one_week.html" title="oramon稳定运行一周">oramon稳定运行一周</a> (5)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/dba/benefit-from-oramon-perf-alert.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>用oramon的数据进行报警</title>
		<link>http://www.anysql.net/dba/oramon-database-perf-alert.html</link>
		<comments>http://www.anysql.net/dba/oramon-database-perf-alert.html#comments</comments>
		<pubDate>Thu, 21 May 2009 07:03:30 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tuning]]></category>

		<guid isPermaLink="false">http://www.anysql.net/wordpress/uncategorized/%e7%94%a8oramon%e7%9a%84%e6%95%b0%e6%8d%ae%e8%bf%9b%e8%a1%8c%e6%8a%a5%e8%ad%a6.html</guid>
		<description><![CDATA[&#160; &#160; 对于互联网企业后台的数据库来讲, 有效的性能监控与报警是非常重要的, 一般来说数据库上的并发事务大, 任何地方出错后, 就会导至数据库进入恶性循环, 如果未及时解决, 要么数据库挂起, 要么让应用挂起, 方能得到最后解脱. 有钱的单位请专门的人员进行7&#215;24小时监控, 专门盯着数据库主机Load的变化, 或者是安装监控程序进行5分钟数据采样, 并根据Load或CPU利用率情况进行报警, 如Nagios等. &#160; &#160; 从实际情况看来, 专人看管和5分钟的监控都不够好, 5分钟可以重起一次一般的数据库了. 监控的频率很难选择, 监控报警的标准很难确定. 关键在于要有良好的性能数据, 及根据这些性能数据的有效报警机制. 用oramon收集Oracle的运行性能数据, 将报警机制集成到实时采集oramon数据的程序中, 就完美解决了这个事情. &#160; &#160; 昨天用Perl重写了oramon数据采集程序, 一是要集成报警功能, 二是性能测试库不一定用Oracle, 可能会用MySQL, 以后也可以用Postgre SQL等, 还是选用脚本型语言较好. oramon以十秒的频率采集数据, 在报警时没有根据一个点的数据来确认是否报警, 而一律根据最后5个采样点的数据, 也就是接近一分钟内5个数据的平均值来判断. 经过一天的测试, 最后的报警条件设置如下. &#160; &#160; 活动会话: 如果最近5个点的活动会话数都大于大于某个值(根据各个数据库的情况, 设置不同的值)就报警. Enq会话: 如果最近5个点的处理Enqueue等待的会话数都大于10就报警. IO等待: 如果最近5个点CPU WIO的比例值都大于40就报警. CPU使用率: 如果最近5个点CPU [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 对于互联网企业后台的数据库来讲, 有效的性能监控与报警是非常重要的, 一般来说数据库上的并发事务大, 任何地方出错后, 就会导至数据库进入恶性循环, 如果未及时解决, 要么数据库挂起, 要么让应用挂起, 方能得到最后解脱. 有钱的单位请专门的人员进行7&#215;24小时监控, 专门盯着数据库主机Load的变化, 或者是安装监控程序进行5分钟数据采样, 并根据Load或CPU利用率情况进行报警, 如Nagios等. </p>
<p>&nbsp; &nbsp; 从实际情况看来, 专人看管和5分钟的监控都不够好, 5分钟可以重起一次一般的数据库了. 监控的频率很难选择, 监控报警的标准很难确定. 关键在于要有良好的性能数据, 及根据这些性能数据的有效报警机制. 用oramon收集Oracle的运行性能数据, 将报警机制集成到实时采集oramon数据的程序中, 就完美解决了这个事情. </p>
<p>&nbsp; &nbsp; 昨天用Perl重写了oramon数据采集程序, 一是要集成报警功能, 二是性能测试库不一定用Oracle, 可能会用MySQL, 以后也可以用Postgre SQL等, 还是选用脚本型语言较好. oramon以十秒的频率采集数据, 在报警时没有根据一个点的数据来确认是否报警, 而一律根据最后5个采样点的数据, 也就是接近一分钟内5个数据的平均值来判断. 经过一天的测试, 最后的报警条件设置如下. </p>
<p>&nbsp; &nbsp; 活动会话: 如果最近5个点的活动会话数都大于大于某个值(根据各个数据库的情况, 设置不同的值)就报警. Enq会话: 如果最近5个点的处理Enqueue等待的会话数都大于10就报警. IO等待: 如果最近5个点CPU WIO的比例值都大于40就报警. CPU使用率: 如果最近5个点CPU User的比例值都大于80就报警. 并行进程: 如果最近5个点活动并行进程的值都大于4就报警. </p>
<p>&nbsp; &nbsp; 利用oramon收集的数据, 可以根据很多有意义的性能数据进行报警设置, 如Swap IO情况, 如physical read, db file scatter read, 平均db file sequential read的等待时间, 还可以根据从Oracle层面计算出来的IOPS量进行报警. </p>
<p>&nbsp; &nbsp; 将报警机制集成在数据扫描程序中, 可以使报警变得很及时, 出现情况一分钟就可以报出来. 另外根据5个点的数据来报警, 误报的机率大大降低. 例如今天就根据Enqueue等待的报警及时发现了问题. 有这样的报警系统才能掌控数据库的运行, 才能做到心中有数, 安心睡觉.</p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-system-event.html" title="oramon如何收集V$SYSTEM_EVENT数据?">oramon如何收集V$SYSTEM_EVENT数据?</a> (3)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-session-history.html" title="oramon如何从V$SESSION收集性能数据?">oramon如何从V$SESSION收集性能数据?</a> (0)</li><li>2009/06/24 -- <a href="http://www.anysql.net/oracle/oramon-system-statistics.html" title="oramon如何从V$SYSSTAT收集性能数据?">oramon如何从V$SYSSTAT收集性能数据?</a> (1)</li><li>2007/08/20 -- <a href="http://www.anysql.net/tools/oramon_running_one_week.html" title="oramon稳定运行一周">oramon稳定运行一周</a> (5)</li><li>2009/11/05 -- <a href="http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html" title="oramon新增三个性能数据">oramon新增三个性能数据</a> (3)</li><li>2009/05/22 -- <a href="http://www.anysql.net/dba/benefit-from-oramon-perf-alert.html" title="从oramon新报警中受益">从oramon新报警中受益</a> (1)</li><li>2009/04/21 -- <a href="http://www.anysql.net/tools/display_oramon_perf_data.html" title="用图表显示oramon数据">用图表显示oramon数据</a> (7)</li><li>2009/04/15 -- <a href="http://www.anysql.net/tools/load_oramon_perf_data.html" title="装载oramon性能数据">装载oramon性能数据</a> (0)</li><li>2009/04/15 -- <a href="http://www.anysql.net/tools/install_and_start_oramon.html" title="安装与运行oramon">安装与运行oramon</a> (2)</li><li>2009/04/14 -- <a href="http://www.anysql.net/tools/oramon_gather_perf_data.html" title="oramon, 收集性能数据">oramon, 收集性能数据</a> (5)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/dba/oramon-database-perf-alert.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>新版oramon正式上线</title>
		<link>http://www.anysql.net/tools/deploy_new_oramon_version.html</link>
		<comments>http://www.anysql.net/tools/deploy_new_oramon_version.html#comments</comments>
		<pubDate>Wed, 20 May 2009 01:06:15 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Tuning]]></category>
		<category><![CDATA[WebChart]]></category>

		<guid isPermaLink="false">http://www.anysql.net/wordpress/uncategorized/%e6%96%b0%e7%89%88oramon%e6%ad%a3%e5%bc%8f%e4%b8%8a%e7%ba%bf.html</guid>
		<description><![CDATA[&#160; &#160; 最近几周在改进oramon, 不停地在增减收集的数据点, 既要增加有用的数据, 又要去掉无用的数据, 断继续续地搞了近一个月, 今天终于将新版本oramon应用到生产环境中去了. 新版本最直接的好处是可以将更多的性能数据, 比较方便地装载到性能数据库中. 以方便第三方平台(如WebChart)来进行展示, 下面是新版本发布后, 增加的一些图形. &#160; &#160; CPU利用率, 包括SYS, WIO和USER, 将所有核心数据库的CPU利用率显示在一起, 进行横向比较. &#160; &#160; Oracle中单块读(sequential read)和多块读(scatter read)的等待次数, 将所有核心数据库的物理读等待次数显示在一起, 进行横向比较. &#160; &#160; Oracle中单块读(sequential read)和多块读(scatter read)的等待时间, 将所有核心数据库的物理读等待时间显示在一起, 进行横向比较. &#160; &#160; Oracle中数据块写(db file parallel write)和日志写(log file parallel write)的等待次数, 将所有核心数据库的物理写等待次数显示在一起, 进行横向比较. &#160; &#160; Oracle中数据块写(db file parallel write)和日志写(log file parallel write)的等待时间, 将所有核心数据库的物理写等待时间显示在一起, [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 最近几周在改进oramon, 不停地在增减收集的数据点, 既要增加有用的数据, 又要去掉无用的数据, 断继续续地搞了近一个月, 今天终于将新版本oramon应用到生产环境中去了. 新版本最直接的好处是可以将更多的性能数据, 比较方便地装载到性能数据库中. 以方便第三方平台(如WebChart)来进行展示, 下面是新版本发布后, 增加的一些图形. </p>
<p>&nbsp; &nbsp; CPU利用率, 包括SYS, WIO和USER, 将所有核心数据库的CPU利用率显示在一起, 进行横向比较. </p>
<blockquote><p>
<img src="http://www.anysql.net/images/neworamon_cpu.gif" border="0" />
</p></blockquote>
<p>&nbsp; &nbsp; Oracle中单块读(sequential read)和多块读(scatter read)的等待次数, 将所有核心数据库的物理读等待次数显示在一起, 进行横向比较. </p>
<blockquote><p>
<img src="http://www.anysql.net/images/neworamon_read.gif" border="0" />
</p></blockquote>
<p>&nbsp; &nbsp; Oracle中单块读(sequential read)和多块读(scatter read)的等待时间, 将所有核心数据库的物理读等待时间显示在一起, 进行横向比较. </p>
<blockquote><p>
<img src="http://www.anysql.net/images/neworamon_readtime.gif" border="0" />
</p></blockquote>
<p>&nbsp; &nbsp; Oracle中数据块写(db file parallel write)和日志写(log file parallel write)的等待次数, 将所有核心数据库的物理写等待次数显示在一起, 进行横向比较. </p>
<blockquote><p>
<img src="http://www.anysql.net/images/neworamon_write.gif" border="0" />
</p></blockquote>
<p>&nbsp; &nbsp; Oracle中数据块写(db file parallel write)和日志写(log file parallel write)的等待时间, 将所有核心数据库的物理写等待时间显示在一起, 进行横向比较. </p>
<blockquote><p>
<img src="http://www.anysql.net/images/neworamon_writetime.gif" border="0" />
</p></blockquote>
<p>&nbsp; &nbsp; Oracle中单块读(db file parallel write)的平均等待时间, 将所有核心数据库的单块读平均时间显示在一起, 进行横向比较. </p>
<blockquote><p>
<img src="http://www.anysql.net/images/neworamon_iotime.gif" border="0" />
</p></blockquote>
<p>&nbsp; &nbsp; Oracle中所有的读和写的等待次数累加起来当作IOPS次数, 将所有核心数据库的Oracle IOPS次数显示在一起, 进行横向比较. </p>
<blockquote><p>
<img src="http://www.anysql.net/images/neworamon_iops.gif" border="0" />
</p></blockquote>
<p>&nbsp; &nbsp; 还收集了很多Oracle数据库中的其他指标, 留下几个图明天或后天再画吧. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2009/05/08 -- <a href="http://www.anysql.net/dba/analyze_perf_data_two.html" title="分析性能数据之二">分析性能数据之二</a> (5)</li><li>2009/05/08 -- <a href="http://www.anysql.net/dba/analyze_perf_data_one.html" title="分析性能数据之一">分析性能数据之一</a> (1)</li><li>2009/04/21 -- <a href="http://www.anysql.net/tools/display_oramon_perf_data.html" title="用图表显示oramon数据">用图表显示oramon数据</a> (7)</li><li>2009/04/15 -- <a href="http://www.anysql.net/tools/load_oramon_perf_data.html" title="装载oramon性能数据">装载oramon性能数据</a> (0)</li><li>2009/04/15 -- <a href="http://www.anysql.net/tools/install_and_start_oramon.html" title="安装与运行oramon">安装与运行oramon</a> (2)</li><li>2009/04/14 -- <a href="http://www.anysql.net/tools/oramon_gather_perf_data.html" title="oramon, 收集性能数据">oramon, 收集性能数据</a> (5)</li><li>2009/04/05 -- <a href="http://www.anysql.net/dba/oramon_webchart_solution.html" title="轻量级Oracle性能监控">轻量级Oracle性能监控</a> (3)</li><li>2010/07/14 -- <a href="http://www.anysql.net/dba/get-aix-hba-iostat.html" title="AIX下获得HBA卡的IO流量信息">AIX下获得HBA卡的IO流量信息</a> (0)</li><li>2009/11/05 -- <a href="http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html" title="oramon新增三个性能数据">oramon新增三个性能数据</a> (3)</li><li>2009/07/09 -- <a href="http://www.anysql.net/dba/oracle-where-filter-order.html" title="SQL执行filter条件的顺序问题">SQL执行filter条件的顺序问题</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/deploy_new_oramon_version.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>分析性能数据之二</title>
		<link>http://www.anysql.net/dba/analyze_perf_data_two.html</link>
		<comments>http://www.anysql.net/dba/analyze_perf_data_two.html#comments</comments>
		<pubDate>Sat, 09 May 2009 00:53:22 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[Tuning]]></category>

		<guid isPermaLink="false">http://www.anysql.net/wordpress/uncategorized/%e5%88%86%e6%9e%90%e6%80%a7%e8%83%bd%e6%95%b0%e6%8d%ae%e4%b9%8b%e4%ba%8c.html</guid>
		<description><![CDATA[&#160; &#160; Oracle中有很多的性能数据可以分析, 有些数据反应的不仅仅是数据库的, 而且可以反应出应用的或架构上的信息, 作为DBA应当主动分析, 并提供给相关的人员, 以协助技术决策. 比如, 应用程序中连接池的设置, 最大允许多少个连接连到数据库中? &#160; &#160; 粗略一看, 好象DBA没有办法得到这些信息, 应当从应用日志中去统计不能获得连接或连接超时的报警信息. 在真实应用中, 大部份的数据库连接都是保持的, 也就是用了连接缓冲池, 会话不会经常断开重连, 因此可以通过持续观察应用服务器在数据库上产生的连接数来分析, 如果真实连接数持续达到了设置的最大值, 就表示需要增大最大连接数的设置了. &#160; &#160; 用如下SQL来取得连接数据, 每5分钟取一次, 然后保存到一张表中, select sysdate day, INSTANCE_NAME, &#160; &#160; &#160; machine, username, count(*) conncount &#160; from v$session, v$instance &#160; group by machine, username, instance_name &#160; &#160; 用WebChart来显示某台机器, 最近两天或三天的连接数, 就可以看出需不需要扩大连接设置了. &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; Oracle中有很多的性能数据可以分析, 有些数据反应的不仅仅是数据库的, 而且可以反应出应用的或架构上的信息, 作为DBA应当主动分析, 并提供给相关的人员, 以协助技术决策. 比如, 应用程序中连接池的设置, 最大允许多少个连接连到数据库中? </p>
<p>&nbsp; &nbsp;  粗略一看, 好象DBA没有办法得到这些信息, 应当从应用日志中去统计不能获得连接或连接超时的报警信息. 在真实应用中, 大部份的数据库连接都是保持的, 也就是用了连接缓冲池, 会话不会经常断开重连, 因此可以通过持续观察应用服务器在数据库上产生的连接数来分析, 如果真实连接数持续达到了设置的最大值, 就表示需要增大最大连接数的设置了. </p>
<p>&nbsp; &nbsp; 用如下SQL来取得连接数据, 每5分钟取一次, 然后保存到一张表中, </p>
<blockquote class="prefont"><p>
select sysdate day, INSTANCE_NAME,<br />
&nbsp; &nbsp; &nbsp;  machine, username, count(*) conncount<br />
&nbsp; from v$session, v$instance <br />
&nbsp; group by machine, username, instance_name
</p></blockquote>
<p>&nbsp; &nbsp; 用WebChart来显示某台机器, 最近两天或三天的连接数, 就可以看出需不需要扩大连接设置了. </p>
<blockquote><p>
<img src="http://www.anysql.net/images/app_db_conns_line.gif" border="0" />
</p></blockquote>
<p>&nbsp; &nbsp; 这其实很简单, 但结果是使我们的应用程序数据库连接设置有数据可依, 真实地发挥了作用. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2009/05/19 -- <a href="http://www.anysql.net/tools/deploy_new_oramon_version.html" title="新版oramon正式上线">新版oramon正式上线</a> (4)</li><li>2009/05/08 -- <a href="http://www.anysql.net/dba/analyze_perf_data_one.html" title="分析性能数据之一">分析性能数据之一</a> (1)</li><li>2010/07/14 -- <a href="http://www.anysql.net/dba/get-aix-hba-iostat.html" title="AIX下获得HBA卡的IO流量信息">AIX下获得HBA卡的IO流量信息</a> (0)</li><li>2009/11/05 -- <a href="http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html" title="oramon新增三个性能数据">oramon新增三个性能数据</a> (3)</li><li>2009/07/09 -- <a href="http://www.anysql.net/dba/oracle-where-filter-order.html" title="SQL执行filter条件的顺序问题">SQL执行filter条件的顺序问题</a> (2)</li><li>2009/07/01 -- <a href="http://www.anysql.net/dba/partition-table-statistics-choose.html" title="分区表用哪个级别的统计信息?">分区表用哪个级别的统计信息?</a> (2)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-system-event.html" title="oramon如何收集V$SYSTEM_EVENT数据?">oramon如何收集V$SYSTEM_EVENT数据?</a> (3)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-session-history.html" title="oramon如何从V$SESSION收集性能数据?">oramon如何从V$SESSION收集性能数据?</a> (0)</li><li>2009/06/24 -- <a href="http://www.anysql.net/oracle/oramon-system-statistics.html" title="oramon如何从V$SYSSTAT收集性能数据?">oramon如何从V$SYSSTAT收集性能数据?</a> (1)</li><li>2009/05/22 -- <a href="http://www.anysql.net/dba/benefit-from-oramon-perf-alert.html" title="从oramon新报警中受益">从oramon新报警中受益</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/dba/analyze_perf_data_two.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>分析性能数据之一</title>
		<link>http://www.anysql.net/dba/analyze_perf_data_one.html</link>
		<comments>http://www.anysql.net/dba/analyze_perf_data_one.html#comments</comments>
		<pubDate>Fri, 08 May 2009 19:01:11 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[Tuning]]></category>

		<guid isPermaLink="false">http://www.anysql.net/wordpress/uncategorized/%e5%88%86%e6%9e%90%e6%80%a7%e8%83%bd%e6%95%b0%e6%8d%ae%e4%b9%8b%e4%b8%80.html</guid>
		<description><![CDATA[&#160; &#160; Oracle中有很多的性能数据可以分析, 有些数据反应的不仅仅是数据库的, 而且可以反应出应用的或架构上的信息, 作为DBA应当主动分析, 并提供给相关的人员, 以协助技术决策. 比如, 系统中会有很多种不同类型的应用服务器, 但数据库往往是少数几个, 在进行多机房应用及数据布局时, 就需要知道各个应用服务器和数据库的交互量, 同一个库上各个不同的应用发起的SQL的百分比. &#160; &#160; 粗略一看, 好象DBA没有办法得到这些信息, 应当从应用日志中去统计分析. 在真实应用中, 大部份的数据库连接都是保持的, 也就是用了连接缓冲池, 会话不会经常断开重连, 因此可以通过会话级的统计值(execute count)得到上面的数据. 具体过程如下, 在一个可以查数据字典的用户下, 创建一个表来保留统计值信息. create table TMP_SESSION_EXECUTES ( &#160; &#160; ID NUMBER(38), &#160; &#160; SID NUMBER(12), &#160; &#160; serial# number(12), &#160; &#160; machine varchar2(64), &#160; &#160; username varchar2(30), &#160; &#160; execute [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; Oracle中有很多的性能数据可以分析, 有些数据反应的不仅仅是数据库的, 而且可以反应出应用的或架构上的信息, 作为DBA应当主动分析, 并提供给相关的人员, 以协助技术决策. 比如, 系统中会有很多种不同类型的应用服务器, 但数据库往往是少数几个, 在进行多机房应用及数据布局时, 就需要知道各个应用服务器和数据库的交互量, 同一个库上各个不同的应用发起的SQL的百分比. </p>
<p>&nbsp; &nbsp; 粗略一看, 好象DBA没有办法得到这些信息, 应当从应用日志中去统计分析. 在真实应用中, 大部份的数据库连接都是保持的, 也就是用了连接缓冲池, 会话不会经常断开重连, 因此可以通过会话级的统计值(execute count)得到上面的数据. 具体过程如下, 在一个可以查数据字典的用户下, 创建一个表来保留统计值信息. </p>
<blockquote class="prefont"><p>
create table TMP_SESSION_EXECUTES<br />
(<br />
&nbsp; &nbsp;  ID NUMBER(38),<br />
&nbsp; &nbsp;  SID NUMBER(12),<br />
&nbsp; &nbsp;  serial# number(12),<br />
&nbsp; &nbsp;  machine varchar2(64),<br />
&nbsp; &nbsp;  username varchar2(30),<br />
&nbsp; &nbsp;  execute number(38)<br />
);
</p></blockquote>
<p>&nbsp; &nbsp; 然后创建一个序列, 来表示一次收集的ID, 如下所示: </p>
<blockquote class="prefont"><p>
create sequence seq_temp_sesstat;
</p></blockquote>
<p>&nbsp; &nbsp; 执行以下代码几个小时, 就可以收集到不少数据, 足以进行上述分析了. </p>
<blockquote class="prefont"><p>
declare<br />
&nbsp;  ver number:=0;<br />
begin<br />
loop<br />
&nbsp;  select seq_temp_sesstat.nextval into ver from dual;<br />
&nbsp;  insert into TMP_SESSION_EXECUTES<br />
&nbsp;  select ver, a.sid,<br />
&nbsp; &nbsp;  a.serial#, a.machine, a.username, b.value <br />
&nbsp;  from v$session a, v$sesstat b<br />
&nbsp;  where a.sid=b.sid<br />
&nbsp; &nbsp;  and b.STATISTIC#=238;<br />
&nbsp;  commit;<br />
&nbsp;  dbms_lock.sleep(300);<br />
end loop;<br />
end;<br />
/
</p></blockquote>
<p>&nbsp; &nbsp; 上面收集到的是累计值, 要前后两个ID相减计算差量值, 可用如下SQL语句. </p>
<blockquote class="prefont"><p>
SELECT MACHINE, USERNAME,&nbsp; SUM(EXECUTE) EXECUTE<br />
FROM (<br />
SELECT A.MACHINE, A.USERNAME, <br />
&nbsp; A.EXECUTE &#8211; NVL(B.EXECUTE,0) EXECUTE<br />
FROM TMP_SESSION_EXECUTES A, TMP_SESSION_EXECUTES B<br />
WHERE A.ID=B.ID+1<br />
&nbsp; AND A.SID=B.SID<br />
&nbsp; AND A.SERIAL#=B.SERIAL#<br />
&nbsp; AND A.MACHINE=B.MACHINE<br />
&nbsp; AND A.USERNAME=B.USERNAME<br />
&nbsp; AND A.EXECUTE &gt; NVL(B.EXECUTE,0) )<br />
GROUP BY MACHINE, USERNAME
</p></blockquote>
<p>&nbsp; &nbsp; 这样就得到了在某个时间段内每台机器在某个用户下的SQL执行量了, 算一下比例就是十分有用的信息. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2009/05/19 -- <a href="http://www.anysql.net/tools/deploy_new_oramon_version.html" title="新版oramon正式上线">新版oramon正式上线</a> (4)</li><li>2009/05/08 -- <a href="http://www.anysql.net/dba/analyze_perf_data_two.html" title="分析性能数据之二">分析性能数据之二</a> (5)</li><li>2010/07/14 -- <a href="http://www.anysql.net/dba/get-aix-hba-iostat.html" title="AIX下获得HBA卡的IO流量信息">AIX下获得HBA卡的IO流量信息</a> (0)</li><li>2009/11/05 -- <a href="http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html" title="oramon新增三个性能数据">oramon新增三个性能数据</a> (3)</li><li>2009/07/09 -- <a href="http://www.anysql.net/dba/oracle-where-filter-order.html" title="SQL执行filter条件的顺序问题">SQL执行filter条件的顺序问题</a> (2)</li><li>2009/07/01 -- <a href="http://www.anysql.net/dba/partition-table-statistics-choose.html" title="分区表用哪个级别的统计信息?">分区表用哪个级别的统计信息?</a> (2)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-system-event.html" title="oramon如何收集V$SYSTEM_EVENT数据?">oramon如何收集V$SYSTEM_EVENT数据?</a> (3)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-session-history.html" title="oramon如何从V$SESSION收集性能数据?">oramon如何从V$SESSION收集性能数据?</a> (0)</li><li>2009/06/24 -- <a href="http://www.anysql.net/oracle/oramon-system-statistics.html" title="oramon如何从V$SYSSTAT收集性能数据?">oramon如何从V$SYSSTAT收集性能数据?</a> (1)</li><li>2009/05/22 -- <a href="http://www.anysql.net/dba/benefit-from-oramon-perf-alert.html" title="从oramon新报警中受益">从oramon新报警中受益</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/dba/analyze_perf_data_one.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>用图表显示oramon数据</title>
		<link>http://www.anysql.net/tools/display_oramon_perf_data.html</link>
		<comments>http://www.anysql.net/tools/display_oramon_perf_data.html#comments</comments>
		<pubDate>Wed, 22 Apr 2009 06:30:07 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Tuning]]></category>
		<category><![CDATA[WebChart]]></category>

		<guid isPermaLink="false">http://www.anysql.net/wordpress/uncategorized/%e7%94%a8%e5%9b%be%e8%a1%a8%e6%98%be%e7%a4%baoramon%e6%95%b0%e6%8d%ae.html</guid>
		<description><![CDATA[&#160; &#160; 用WebChart来显示数据库中的数据, 是非常方便的, 因此当oramon中的数据进入数据库后, 就可以用WebChart来进行分析了, 例如某个数据库主机上CPU的数据. &#160; &#160; 当然可以将更多的图, 例如某数据库的各个性能数据, 显示在一个页面中, 可以根据这个页面的源代码, 轻松地编写出很多个WebChart的页面, 如显示所有数据库的CPU使用情况, 进行横向比较. &#160; &#160; 再用HTML树(Tree)做一个导航页面, 用scanomon将oramon和WebChart连接起来, 严然就是一个数据库性能分析与监控系统了, 在数据库性能分析上胜过很多的商业软件. &#160; &#160; 在不耻努力地推动和介绍下, 有几个在集成公司的好朋友已经开始试用oramon和WebChart了. Relative Posts:2009/04/15 -- 装载oramon性能数据 (0)2009/04/15 -- 安装与运行oramon (2)2009/04/14 -- oramon, 收集性能数据 (5)2009/11/05 -- oramon新增三个性能数据 (3)2009/06/25 -- oramon如何收集V$SYSTEM_EVENT数据? (3)2009/06/25 -- oramon如何从V$SESSION收集性能数据? (0)2009/06/24 -- oramon如何从V$SYSSTAT收集性能数据? (1)2009/05/22 -- 从oramon新报警中受益 (1)2009/05/21 -- 用oramon的数据进行报警 [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 用<a href="http://www.dbatools.net/mytools/webchart_feature_overview.html">WebChart</a>来显示数据库中的数据, 是非常方便的, 因此当oramon中的数据<a href="http://www.anysql.net/tools/load_oramon_perf_data.html">进入数据库</a>后, 就可以用WebChart来进行分析了, 例如某个数据库主机上CPU的数据. </p>
<blockquote><p>
<img src="http://www.anysql.net/images/perf_by_db.gif" border="0" />
</p></blockquote>
<p>&nbsp; &nbsp; 当然可以将更多的图, 例如某数据库的各个性能数据, <a href="http://www.flickr.com/photos/anysql/3462691146/">显示在一个页面</a>中, 可以根据这个页面的<a href="http://www.anysql.net/doc/perf_by_db.txt" target="_blank">源代码</a>, 轻松地编写出很多个WebChart的页面, 如显示所有数据库的CPU使用情况, 进行横向比较.  </p>
<p>&nbsp; &nbsp; 再用<a href="http://www.anysql.net/doc/tree/tree.html">HTML树(Tree)</a>做一个导航页面, 用scanomon将oramon和WebChart连接起来, 严然就是一个数据库性能分析与监控系统了, 在数据库性能分析上胜过很多的商业软件. </p>
<p>&nbsp; &nbsp; 在不耻努力地推动和介绍下, 有几个在集成公司的好朋友已经开始试用oramon和WebChart了. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2009/04/15 -- <a href="http://www.anysql.net/tools/load_oramon_perf_data.html" title="装载oramon性能数据">装载oramon性能数据</a> (0)</li><li>2009/04/15 -- <a href="http://www.anysql.net/tools/install_and_start_oramon.html" title="安装与运行oramon">安装与运行oramon</a> (2)</li><li>2009/04/14 -- <a href="http://www.anysql.net/tools/oramon_gather_perf_data.html" title="oramon, 收集性能数据">oramon, 收集性能数据</a> (5)</li><li>2009/11/05 -- <a href="http://www.anysql.net/tools/oramon-arclog-undo-logfilesync.html" title="oramon新增三个性能数据">oramon新增三个性能数据</a> (3)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-system-event.html" title="oramon如何收集V$SYSTEM_EVENT数据?">oramon如何收集V$SYSTEM_EVENT数据?</a> (3)</li><li>2009/06/25 -- <a href="http://www.anysql.net/tools/oramon-session-history.html" title="oramon如何从V$SESSION收集性能数据?">oramon如何从V$SESSION收集性能数据?</a> (0)</li><li>2009/06/24 -- <a href="http://www.anysql.net/oracle/oramon-system-statistics.html" title="oramon如何从V$SYSSTAT收集性能数据?">oramon如何从V$SYSSTAT收集性能数据?</a> (1)</li><li>2009/05/22 -- <a href="http://www.anysql.net/dba/benefit-from-oramon-perf-alert.html" title="从oramon新报警中受益">从oramon新报警中受益</a> (1)</li><li>2009/05/21 -- <a href="http://www.anysql.net/dba/oramon-database-perf-alert.html" title="用oramon的数据进行报警">用oramon的数据进行报警</a> (3)</li><li>2009/05/19 -- <a href="http://www.anysql.net/tools/deploy_new_oramon_version.html" title="新版oramon正式上线">新版oramon正式上线</a> (4)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/display_oramon_perf_data.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
