<?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; Startup</title>
	<atom:link href="http://www.anysql.net/tag/startup/feed" rel="self" type="application/rss+xml" />
	<link>http://www.anysql.net</link>
	<description>SQLULDR2, DataCopy, DataSync, WebChart, OraMon, AUL/MyDUL, 性能优化及容量分析</description>
	<lastBuildDate>Sun, 29 Aug 2010 00:14:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>按Sequence查找归档日志</title>
		<link>http://www.anysql.net/developer/find_log_by_sequence.html</link>
		<comments>http://www.anysql.net/developer/find_log_by_sequence.html#comments</comments>
		<pubDate>Wed, 26 Nov 2008 05:47:20 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Developer]]></category>
		<category><![CDATA[Archive]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[Startup]]></category>

		<guid isPermaLink="false">http://www.anysql.net/wordpress/uncategorized/%e6%8c%89sequence%e6%9f%a5%e6%89%be%e5%bd%92%e6%a1%a3%e6%97%a5%e5%bf%97.html</guid>
		<description><![CDATA[&#160; &#160; 在归档日志管理中很重要的一个功能, 就是根据一个Sequence号, 来查找归档日志的路径. 普通的做法是使用find命令来实现, 如下所示: # # Get the full archived log name by sequence # sub findLogBySequence { &#160; &#160; my ($logseq) = @_; &#160; &#160; my $logfile = &#8220;&#8221;; &#160; &#160; if (length($logfile) == 0) &#160; &#160; { &#160; &#160; &#160; &#160; # Foloowing logic is for Oracle 9i (sid_%t_%s.arc) &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 在归档日志管理中很重要的一个功能, 就是根据一个Sequence号, 来查找归档日志的路径. 普通的做法是使用find命令来实现, 如下所示: </p>
<blockquote class="prefont"><p>
#<br />
# Get the full archived log name by sequence<br />
#<br />
sub findLogBySequence<br />
{<br />
&nbsp; &nbsp; my ($logseq) = @_;<br />
&nbsp; &nbsp; my $logfile = &#8220;&#8221;;</p>
<p>&nbsp; &nbsp; if (length($logfile) == 0)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; # Foloowing logic is for Oracle 9i (sid_%t_%s.arc)<br />
&nbsp; &nbsp; &nbsp; &nbsp; $logfile = `find /data*/arch -follow -name *_${logseq}.* | head -1`;<br />
&nbsp; &nbsp; &nbsp; &nbsp; chomp($logfile);<br />
&nbsp; &nbsp; &nbsp; &nbsp; # Foloowing logic is for Oracle 10g (sid_%t_%s_%r.arc)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (length($logfile) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $logfile = `find /data*/arch -follow -name *_${logseq}_* | head -1`;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  chomp($logfile);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</p>
<p>&nbsp; &nbsp; scalar $logfile;<br />
}
</p></blockquote>
<p>&nbsp; &nbsp; 如果要管理的归档日志很多, 可能要跑成百上千次find命令, 有些资源上的浪费, 可以好好优化一下, 一般来讲同类的归档肯定是放在一起的. 因此将上面的Perl程序优化如下: </p>
<p><span id="more-558"></span></p>
<blockquote class="prefont"><p>
my $logfmt = &#8220;???&#8221;;<br />
#<br />
# Get the full archived log name by sequence<br />
#<br />
sub findLogBySequence<br />
{<br />
&nbsp; &nbsp; my ($logseq) = @_;<br />
&nbsp; &nbsp; my $logfile = &#8220;&#8221;;</p>
<p>&nbsp; &nbsp; #<br />
&nbsp; &nbsp; # if archive log pattern is not null<br />
&nbsp; &nbsp; # get the archive log file from pattern<br />
&nbsp; &nbsp; #<br />
&nbsp; &nbsp; if ($logfmt ne &#8220;???&#8221;)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; $logfile = $logfmt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; $logfile =~ s/XXXXXX/${logseq}/g;<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (! -e $logfile)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $logfile = &#8220;&#8221;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $logfmt = &#8220;???&#8221;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</p>
<p>&nbsp; &nbsp; if (length($logfile) == 0)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; # Foloowing logic is for Oracle 9i (sid_%t_%s.arc)<br />
&nbsp; &nbsp; &nbsp; &nbsp; $logfile = `find /data*/arch -follow -name *_${logseq}.* | head -1`;<br />
&nbsp; &nbsp; &nbsp; &nbsp; chomp($logfile);<br />
&nbsp; &nbsp; &nbsp; &nbsp; # Foloowing logic is for Oracle 10g (sid_%t_%s_%r.arc)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (length($logfile) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $logfile = `find /data*/arch -follow -name *_${logseq}_* | head -1`;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  chomp($logfile);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</p>
<p>&nbsp; &nbsp; # Store the archive log pattern<br />
&nbsp; &nbsp; if (length($logfile) and -e $logfile and $logfmt eq &#8220;???&#8221;)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; $logfmt = $logfile;<br />
&nbsp; &nbsp; &nbsp; &nbsp; $logfmt =~ s/_${logseq}\./_XXXXXX\./;<br />
&nbsp; &nbsp; &nbsp; &nbsp; $logfmt =~ s/_${logseq}_/_XXXXXX_/;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; scalar $logfile;<br />
}
</p></blockquote>
<p>&nbsp; &nbsp; 有了高效的查找日志路径的算法, 就可以做更多智能的功能了, 如指定保留多少GB的归档. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2008/11/25 -- <a href="http://www.anysql.net/developer/purge_archivelog_by_space.html" title="指定保留多少GB的归档">指定保留多少GB的归档</a> (1)</li><li>2008/11/20 -- <a href="http://www.anysql.net/dba/perl_purge_primary_archivelog.html" title="用Perl写Primary维护脚本">用Perl写Primary维护脚本</a> (1)</li><li>2008/11/15 -- <a href="http://www.anysql.net/dba/perl_purge_standby_archivelog.html" title="用Perl写Standby维护脚本">用Perl写Standby维护脚本</a> (1)</li><li>2009/07/08 -- <a href="http://www.anysql.net/developer/perl-script-crontab-schedule.html" title="在Crontab中调度Perl程序">在Crontab中调度Perl程序</a> (2)</li><li>2009/02/12 -- <a href="http://www.anysql.net/developer/get_aix_net_traffic.html" title="准确获取AIX的网络流量">准确获取AIX的网络流量</a> (0)</li><li>2008/12/04 -- <a href="http://www.anysql.net/developer/perl_get_disk_space.html" title="Perl取Linux/Unix磁盘空间">Perl取Linux/Unix磁盘空间</a> (4)</li><li>2008/11/28 -- <a href="http://www.anysql.net/developer/perl_is_tcp_port_alive.html" title="用Perl进行TCP端口确认">用Perl进行TCP端口确认</a> (0)</li><li>2008/08/28 -- <a href="http://www.anysql.net/developer/perl_aix_perfstat_script.html" title="Perl AIX-Perfstat-0.03编程">Perl AIX-Perfstat-0.03编程</a> (0)</li><li>2008/08/28 -- <a href="http://www.anysql.net/developer/install_perl_aix_perfstat.html" title="安装Perl AIX-Perfstat-0.03">安装Perl AIX-Perfstat-0.03</a> (1)</li><li>2007/08/22 -- <a href="http://www.anysql.net/dba/oracle_auto_startup.html" title="Oracle需要手工启动, 无法自动启动">Oracle需要手工启动, 无法自动启动</a> (4)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/developer/find_log_by_sequence.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle需要手工启动, 无法自动启动</title>
		<link>http://www.anysql.net/dba/oracle_auto_startup.html</link>
		<comments>http://www.anysql.net/dba/oracle_auto_startup.html#comments</comments>
		<pubDate>Thu, 23 Aug 2007 03:58:21 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Startup]]></category>

		<guid isPermaLink="false">http://www.anysql.net/wordpress/uncategorized/oracle%e9%9c%80%e8%a6%81%e6%89%8b%e5%b7%a5%e5%90%af%e5%8a%a8-%e6%97%a0%e6%b3%95%e8%87%aa%e5%8a%a8%e5%90%af%e5%8a%a8.html</guid>
		<description><![CDATA[&#160; &#160; 02年做在一公司作Oracle DBA支持时, 我也经常在客户那儿写开机后自动启动数据库, 关机前自动停止数据库的角本, 那时也特强调要实现自动化, 但经过最近三年半的大公司的DBA经验, 经过三年管理OLTP型的数据库的生涯, 如今我不会再去写这样的角本了, 不是写不出来, 而是不愿写. &#160; &#160; 最近的三年中, 唯一自动启动和关闭的数据库是我笔记本上的库, 用来自已玩和做些研究的, 最近还是改成了手工启动. 对于DBA来讲, 数据库的重启是一件很重要的事, 必须要亲自去操心一下的; 数据库的重启还是一种机会, OLTP型的数据库很难得有重启的机会的, 在重机时你可以调整一些参数, 或顺便做一些维护性质的工作, 有时侯为了作一些调整, 如移动文件位置等操作, 等重起的机会还得等几个星期呢. 你说这样的机会能放过吗? &#160; &#160; 这几天又在网上看见有人问, 机器重起后, 数据库和监听器不能自动重启了怎么办? 我的回签是, 不能自动重启就手工启吧! 当然你可以写几行角本, 然后双击鼠标(Windows)或是手工执行(Linux/Unix)来启动数据库. &#160; &#160; 就算你是领导, 也不要一定强求手下的人用自动化来实现自动启动的功能, 没有必要. 很多数据库出问题都是在半年或一年/几年没有人看的情况下, 为什么不去看? 连最单的活都实现自动化了, 当然不看了, 而是去上上网喝喝茶看看报炒炒股了. &#160; &#160; 欢迎不同的意见. Relative Posts:2009/06/25 -- oramon如何收集V$SYSTEM_EVENT数据? [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 02年做在一公司作Oracle DBA支持时, 我也经常在客户那儿写开机后自动启动数据库, 关机前自动停止数据库的角本, 那时也特强调要实现自动化, 但经过最近三年半的大公司的DBA经验, 经过三年管理OLTP型的数据库的生涯, 如今我不会再去写这样的角本了, <strong>不是写不出来, 而是不愿写</strong>.</p>
<p>&nbsp; &nbsp; 最近的三年中, 唯一自动启动和关闭的数据库是我笔记本上的库, 用来自已玩和做些研究的, 最近还是改成了手工启动. 对于DBA来讲, 数据库的重启是一件很重要的事, 必须要亲自去操心一下的; 数据库的重启还是一种机会, OLTP型的数据库很难得有重启的机会的, 在重机时你可以调整一些参数, 或顺便做一些维护性质的工作, 有时侯为了作一些调整, 如移动文件位置等操作, 等重起的机会还得等几个星期呢. 你说这样的机会能放过吗? </p>
<p>&nbsp; &nbsp; 这几天又在网上看见有人问, 机器重起后, 数据库和监听器不能自动重启了怎么办? 我的回签是, <strong>不能自动重启就手工启吧</strong>! 当然你可以写几行角本, 然后双击鼠标(Windows)或是手工执行(Linux/Unix)来启动数据库. </p>
<p>&nbsp; &nbsp; 就算你是领导, 也不要一定强求手下的人用自动化来实现自动启动的功能, 没有必要. 很多数据库出问题都是在半年或一年/几年没有人看的情况下, 为什么不去看? 连最单的活都实现自动化了, 当然不看了, 而是去<strong>上上网喝喝茶看看报炒炒股</strong>了. </p>
<p>&nbsp; &nbsp; 欢迎不同的意见.</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/26 -- <a href="http://www.anysql.net/dba/hard-choose-mysql-or-oracle.html" title="MySQL或Oracle, 是个问题?">MySQL或Oracle, 是个问题?</a> (7)</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/05 -- <a href="http://www.anysql.net/dba/oramon_webchart_solution.html" title="轻量级Oracle性能监控">轻量级Oracle性能监控</a> (3)</li><li>2008/12/13 -- <a href="http://www.anysql.net/developer/owc_sub_chart_demo.html" title="如何画一个SubChart图?">如何画一个SubChart图?</a> (3)</li><li>2008/12/11 -- <a href="http://www.anysql.net/developer/owc_sparse_data_chart.html" title="画一个Web图表有多难?">画一个Web图表有多难?</a> (0)</li><li>2008/12/11 -- <a href="http://www.anysql.net/developer/web_tow_axis_chart.html" title="画图? WebChart够用了!">画图? WebChart够用了!</a> (1)</li><li>2008/11/25 -- <a href="http://www.anysql.net/developer/purge_archivelog_by_space.html" title="指定保留多少GB的归档">指定保留多少GB的归档</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/dba/oracle_auto_startup.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
