<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[『AskWan』]]></title> 
<link>http://www.askwan.com/index.php</link> 
<description><![CDATA[Related Work【Unix,Linux,Mysql,PostgreSQL,Oracle】]]></description> 
<language>en-US</language> 
<copyright><![CDATA[『AskWan』]]></copyright>
<item>
<link>http://www.askwan.com/post/215/</link>
<title><![CDATA[恭祝2010年新春快乐]]></title> 
<author>askwan &lt;askwan@yahoo.cn&gt;</author>
<category><![CDATA[My Diary]]></category>
<pubDate>Tue, 09 Feb 2010 01:40:46 +0000</pubDate> 
<guid>http://www.askwan.com/post/215/</guid> 
<description>
<![CDATA[ 
	春节即将到来，提前预祝大家 <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 春节好！
]]>
</description>
</item><item>
<link>http://www.askwan.com/configuration_oracle_10g_archive_log_mode/</link>
<title><![CDATA[configuration oracle 10g archive log mode ]]></title> 
<author>askwan &lt;askwan@yahoo.cn&gt;</author>
<category><![CDATA[DataBase]]></category>
<pubDate>Fri, 15 Jan 2010 07:18:45 +0000</pubDate> 
<guid>http://www.askwan.com/configuration_oracle_10g_archive_log_mode/</guid> 
<description>
<![CDATA[ 
	VERSION:<br/><br/><div class="code"><br/>SQL&gt; select * from v$version;<br/><br/>BANNER<br/>----------------------------------------------------------------<br/>Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit<br/>PL/SQL Release 10.2.0.4.0 - Production<br/>CORE&nbsp;&nbsp;&nbsp;&nbsp;10.2.0.4.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Production<br/>TNS for Linux: Version 10.2.0.4.0 - Production<br/>NLSRTL Version 10.2.0.4.0 - Production</div><br/><br/>Check current database archive log mode <br/><br/><div class="code">SQL&gt; select dbid,name,log_mode from v$database;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DBID NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LOG_MODE<br/>---------- --------- ------------<br/>2406511032 CAPITALV&nbsp;&nbsp;NOARCHIVELOG<br/><br/><br/>SQL&gt; archive log list;<br/>Database log mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No Archive Mode<br/>Automatic archival&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Disabled<br/>Archive destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;USE_DB_RECOVERY_FILE_DEST<br/>Oldest online log sequence&nbsp;&nbsp;&nbsp;&nbsp; 32<br/>Current log sequence&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 34</div><br/><br/>shutdown database clear<br/><br/><div class="code">SQL&gt; shutdown immediate<br/>Database closed.<br/>Database dismounted.<br/>ORACLE instance shut down.</div><br/><br/>startup database to mount status:<br/><div class="code">SQL&gt; startup mount;<br/>ORACLE instance started.<br/><br/>Total System Global Area&nbsp;&nbsp;285212672 bytes<br/>Fixed Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2083368 bytes<br/>Variable Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 142607832 bytes<br/>Database Buffers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;134217728 bytes<br/>Redo Buffers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6303744 bytes<br/>Database mounted.</div><br/><br/><br/>open database archive log mode :<br/><br/><div class="code">SQL&gt; alter database archivelog;<br/><br/>Database altered.<br/><br/>SQL&gt; alter database open;<br/><br/>Database altered.<br/><br/>SQL&gt; archive log list;<br/>Database log mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Archive Mode<br/>Automatic archival&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Enabled<br/>Archive destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;USE_DB_RECOVERY_FILE_DEST<br/>Oldest online log sequence&nbsp;&nbsp;&nbsp;&nbsp; 32<br/>Next log sequence to archive&nbsp;&nbsp; 34<br/>Current log sequence&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 34</div><br/><br/>stop archive log mode :<br/><br/><div class="code">SQL&gt; shutdown immediate ;<br/>Database closed.<br/>Database dismounted.<br/>ORACLE instance shut down.<br/> <br/>SQL&gt; startup mount;<br/>ORACLE instance started.<br/><br/>Total System Global Area&nbsp;&nbsp;285212672 bytes<br/>Fixed Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2083368 bytes<br/>Variable Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 142607832 bytes<br/>Database Buffers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;134217728 bytes<br/>Redo Buffers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6303744 bytes<br/>Database mounted.<br/>SQL&gt; alter database noarchivelog;<br/><br/>Database altered.<br/><br/>SQL&gt; alter database open;<br/><br/>Database altered.<br/><br/>SQL&gt; archive log list;<br/>Database log mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No Archive Mode<br/>Automatic archival&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Disabled<br/>Archive destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;USE_DB_RECOVERY_FILE_DEST<br/>Oldest online log sequence&nbsp;&nbsp;&nbsp;&nbsp; 32<br/>Current log sequence&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 34</div><br/><br/><br/>Tags - <a href="http://www.askwan.com/tags/oracle/" rel="tag">oracle</a> , <a href="http://www.askwan.com/tags/archive/" rel="tag">archive</a> , <a href="http://www.askwan.com/tags/archivelog/" rel="tag">archivelog</a> , <a href="http://www.askwan.com/tags/mode/" rel="tag">mode</a>
]]>
</description>
</item><item>
<link>http://www.askwan.com/post/212/</link>
<title><![CDATA[oracle 10g em and isqlplus unrecognizable chinese characters on debian lenny   ]]></title> 
<author>askwan &lt;askwan@yahoo.cn&gt;</author>
<category><![CDATA[DataBase]]></category>
<pubDate>Mon, 28 Dec 2009 04:26:27 +0000</pubDate> 
<guid>http://www.askwan.com/post/212/</guid> 
<description>
<![CDATA[ 
	OS:Debian Lenny 503 amd64<br/>Oracle 10g R2 <br/><br/><div class="code">emctl stop dbconsole<br/>isqlplusctl stop</div><br/><br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">cd $ORACLE_HOME/jdk/jre/lib <br/>mv font.properties font.properties_bak20091229<br/>cp -frp font.properties.zh_CN.Redhat font.properties</div></div><br/><br/>vim font.properties<br/>in the last line :<br/>change <br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">filename.-misc-zysong18030-medium-r-normal--*-%d-*-*-c-*-iso10646-1=/usr/share/fonts/zh_CN/TrueType/zysong.ttf<br/></div></div><br/>to <br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">filename.-misc-zysong18030-medium-r-normal--*-%d-*-*-c-*-iso10646-1=/usr/share/fonts/zh_CN/TrueType/simhei.ttf</div></div><br/><br/>simhei.ttf copied from windows (C:&#92;WINDOWS&#92;Fonts ) <br/><br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">cp -f font.properties $ORACLE_HOME/jre/1.4.2/lib<br/>cp -f font.properties $ORACLE_HOME/javavm/lib/ojvmfonts</div></div><br/><br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">rm -fr $ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/em/em/cabo/images/cache/zhs/*.gif <br/>rm -fr $ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/isqlplus/isqlplus/cabo/images/cache/*.gif </div></div><br/><br/><div class="code">emctl start dbconsole<br/>isqlplusctl start</div><br/><br/>-------EOF--------
]]>
</description>
</item><item>
<link>http://www.askwan.com/use_Pgpool-II_and_heartbeat_realize_high_availability_of_postgresql/</link>
<title><![CDATA[use Pgpool-II and HeartBeat realize high availability of postgresql ]]></title> 
<author>askwan &lt;askwan@yahoo.cn&gt;</author>
<category><![CDATA[Architecture &amp; HA]]></category>
<pubDate>Fri, 04 Dec 2009 01:42:15 +0000</pubDate> 
<guid>http://www.askwan.com/use_Pgpool-II_and_heartbeat_realize_high_availability_of_postgresql/</guid> 
<description>
<![CDATA[ 
	Pgpool-II:<br/>pgpool-II is a middleware that works between PostgreSQL servers and a PostgreSQL database client.<br/><a href="http://pgpool.projects.postgresql.org/" target="_blank">http://pgpool.projects.postgresql.org/</a><br/>it can used for Connection Pooling,Replication,Load Balance,Limiting Exceeding Connections and Parallel Query<br/><br/>that&nbsp;&nbsp;Heartbeat is a daemon that provides cluster infrastructure (communication and membership) services to its clients.<br/><a href="http://www.linux-ha.org/" target="_blank">http://www.linux-ha.org/</a><br/><br/>I have archived this :<br/><a href="http://www.askwan.com/attachment.php?fid=197" target="_blank"><img src="http://www.askwan.com/attachment.php?fid=197" class="insertimage" alt="Open in new window" title="Open in new window" border="0"/></a><br/><br/>May be I have to do more testing :)<br/>Tags - <a href="http://www.askwan.com/tags/pgpool-ii/" rel="tag">pgpool-ii</a> , <a href="http://www.askwan.com/tags/heartbeat/" rel="tag">heartbeat</a> , <a href="http://www.askwan.com/tags/realize/" rel="tag">realize</a> , <a href="http://www.askwan.com/tags/high/" rel="tag">high</a> , <a href="http://www.askwan.com/tags/availability/" rel="tag">availability</a> , <a href="http://www.askwan.com/tags/postgresql/" rel="tag">postgresql</a> , <a href="http://www.askwan.com/tags/pgpool2/" rel="tag">pgpool2</a>
]]>
</description>
</item><item>
<link>http://www.askwan.com/Postgresql_Warm_Standby_point_in_time_recovery/</link>
<title><![CDATA[Postgresql Warm Standby Testing]]></title> 
<author>askwan &lt;askwan@yahoo.cn&gt;</author>
<category><![CDATA[DataBase]]></category>
<pubDate>Thu, 03 Dec 2009 03:24:12 +0000</pubDate> 
<guid>http://www.askwan.com/Postgresql_Warm_Standby_point_in_time_recovery/</guid> 
<description>
<![CDATA[ 
	OS: Debian5.0&nbsp;&nbsp;lenny x86_64<br/>Postgresql:8.3.8 <br/>Master :192.168.0.121<br/>Warm&nbsp;&nbsp;Standby:192.168.0.122<br/><br/> <a href="http://www.askwan.com/attachment.php?fid=196" target="_blank"><img src="http://www.askwan.com/attachment.php?fid=196" class="insertimage" alt="Open in new window" title="Open in new window" border="0"/></a><br/>1.&nbsp;&nbsp;install postgresql on both master and warm standby server.<br/><div class="code">#cd /usr/local/src/postgresql-8.3.8/<br/>#./configure –prefix=/usr/local/pgsql<br/>#make <br/>#make install<br/>#mkdir /usr/local/pgsql/data<br/>#chown postgres /usr/local/pgsql/data<br/>#su - postgres<br/>$/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data</div><br/><br/><br/>2.&nbsp;&nbsp;Config passwordless ssh authentication use user postgres <br/>Please refer to <a href="http://www.petefreitag.com/item/532.cfm" target="_blank">http://www.petefreitag.com/item/532.cfm</a><br/><br/>3.&nbsp;&nbsp;Install pg_standby on both both master and warm standby server.<br/><br/><div class="code"><br/>#cd /usr/local/src/postgresql-8.3.8/contrib/pg_standby<br/>#make <br/>#make install <br/></div><br/><br/>4.&nbsp;&nbsp;Config postgresql&nbsp;&nbsp;<br/><br/>In master&nbsp;&nbsp;server :<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">archive_mode = on<br/>archive_command = 'rsync -arv %p postgres@192.168.0.122:/wal_archives/%f'<br/>archive_timeout = 1200</div></div><br/><br/>in warm standby server :<br/><div class="code">#mkdir /wal_archives<br/>#chown postgres /wal_archives/</div><br/><br/>start&nbsp;&nbsp;master server :<br/><div class="code">pg_ctl -D /usr/local/pgsql/data/ start -l /usr/local/pgsql/data/logfile</div><br/><br/><br/><br/>5.&nbsp;&nbsp;Dump all production data to master server&nbsp;&nbsp;.<br/><br/>You can check the warm standby server ‘s /wal_archives directory , whether there is archive logs&nbsp;&nbsp;from master server located on .<br/><br/>6.&nbsp;&nbsp;Login to master&nbsp;&nbsp;server as postgres user.<br/>Create a script to do a base backup:<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">#!/bin/bash<br/>PGDATA=/usr/local/pgsql/data<br/>psql -c "CHECKPOINT;"<br/>psql -c "SELECT pg_start_backup('BASEBACKUP');"<br/>tar -C /usr/local/pgsql/ -zcf - data &#124;ssh 192.168.0.122 "tar -C /usr/local/pgsql/ -zxf -"<br/>psql -c "select pg_stop_backup();"<br/>echo "BASEBACKUP compete!"</div></div><br/>7.&nbsp;&nbsp;Login to warm standby server as postgresql user.<br/>Create a script to do some clean and configuration<br/><br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">#!/bin/bash<br/>PG_HOME=/usr/local/pgsql<br/>PGDATA=/usr/local/pgsql/data<br/>trigger_file=/tmp/pgsql.trigger<br/>pg_standby=$PG_HOME/bin/pg_standby<br/>PG_ARCHIVES=/wal_archives<br/>&nbsp;&nbsp;rm -f $PGDATA/recovery.*<br/>&nbsp;&nbsp;rm -f $PGDATA/logfile<br/>&nbsp;&nbsp;rm -f $PGDATA/postmaster.pid<br/>&nbsp;&nbsp;rm -f $PGDATA/pg_xlog/0*<br/>&nbsp;&nbsp;rm -f $PGDATA/pg_xlog/archive_status/0*<br/>&nbsp;&nbsp;sed -i '/^archive_/s/^/#/g' $PGDATA/postgresql.conf<br/>&nbsp;&nbsp;echo "restore_command = '$pg_standby -l -d -s 2 -t $trigger_file $PG_ARCHIVES %f %p %r 2>>/tmp/standby.log'" > $PGDATA/recovery.co<br/>nf<br/>&nbsp;&nbsp;chown postgres.postgres $PGDATA/recovery.conf<br/>&nbsp;&nbsp;echo "Init completed! now start warm standby server."</div></div><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>Note:PostgreSQL 8.4 provides the recovery_end_command option.so,in recovery.conf add recovery_end_command=’rm –f /tmp/pgsql.trigger ’<br/><br/>pg_standby supports creation of a "warm standby" database server. It is designed to be a production-ready program, as well as a customizable template should you require specific modifications.<br/>More about pg_standby,refer to <a href="http://www.postgresql.org/docs/current/static/pgstandby.html" target="_blank">http://www.postgresql.org/docs/current/static/pgstandby.html</a><br/><a href="http://www.enterprisedb.com/docs/en/8.4/pg/pgstandby.html" target="_blank">http://www.enterprisedb.com/docs/en/8.4/pg/pgstandby.html</a><br/><br/><br/><br/>8.&nbsp;&nbsp;Start&nbsp;&nbsp;warm standby server <br/><div class="code">pg_ctl -D /usr/local/pgsql/data start -l /usr/local/pgsql/data/logfile</div><br/><br/>9.&nbsp;&nbsp;check&nbsp;&nbsp;warm standby postgresql&nbsp;&nbsp;logfile:<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">LOG:&nbsp;&nbsp;database system was interrupted; last known up at 2009-12-03 11:44:37 CST<br/>LOG:&nbsp;&nbsp;starting archive recovery<br/>LOG:&nbsp;&nbsp;restore_command = '/usr/local/pgsql/bin/pg_standby -l -d -s 2 -t /tmp/pgsql.trigger /wal_archives %f %p %r 2>>/tmp/standby.log<br/>'<br/>LOG:&nbsp;&nbsp;restored log file "000000010000000000000014.00000020.backup" from archive<br/>LOG:&nbsp;&nbsp;restored log file "000000010000000000000014" from archive<br/>LOG:&nbsp;&nbsp;automatic recovery in progress<br/>LOG:&nbsp;&nbsp;redo starts at 0/14000068<br/>FATAL:&nbsp;&nbsp;the database system is starting up<br/>LOG:&nbsp;&nbsp;restored log file "000000010000000000000015" from archive<br/>LOG:&nbsp;&nbsp;restored log file "000000010000000000000016" from archive<br/>LOG:&nbsp;&nbsp;restored log file "000000010000000000000017" from archive<br/>LOG:&nbsp;&nbsp;restored log file "000000010000000000000018" from archive<br/>LOG:&nbsp;&nbsp;restored log file "000000010000000000000019" from archive<br/>LOG:&nbsp;&nbsp;restored log file "00000001000000000000001A" from archive<br/>LOG:&nbsp;&nbsp;restored log file "00000001000000000000001B" from archive<br/>LOG:&nbsp;&nbsp;restored log file "00000001000000000000001C" from archive<br/>LOG:&nbsp;&nbsp;restored log file "00000001000000000000001D" from archive<br/>LOG:&nbsp;&nbsp;restored log file "00000001000000000000001E" from archive<br/>LOG:&nbsp;&nbsp;restored log file "00000001000000000000001F" from archive<br/>LOG:&nbsp;&nbsp;restored log file "000000010000000000000020" from archive<br/>LOG:&nbsp;&nbsp;restored log file "000000010000000000000021" from archive<br/>……</div></div><br/><br/>Check standby logfile:<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">Trigger file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: /tmp/pgsql.trigger<br/>Waiting for WAL file&nbsp;&nbsp;&nbsp;&nbsp;: 00000001.history<br/>WAL file path&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : /wal_archives/00000001.history<br/>Restoring to...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : pg_xlog/RECOVERYHISTORY<br/>Sleep interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 2 seconds<br/>Max wait interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0 forever<br/>Command for restore&nbsp;&nbsp;&nbsp;&nbsp; : ln -s -f "/wal_archives/00000001.history" "pg_xlog/RECOVERYHISTORY"<br/>Keep archive history&nbsp;&nbsp;&nbsp;&nbsp;: 000000000000000000000000 and later<br/>running restore&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : OK<br/>Trigger file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: /tmp/pgsql.trigger<br/>Waiting for WAL file&nbsp;&nbsp;&nbsp;&nbsp;: 000000010000000000000014.00000020.backup<br/>WAL file path&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : /wal_archives/000000010000000000000014.00000020.backup<br/>Restoring to...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : pg_xlog/RECOVERYHISTORY<br/>Sleep interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 2 seconds<br/>Max wait interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0 forever<br/>Command for restore&nbsp;&nbsp;&nbsp;&nbsp; : ln -s -f "/wal_archives/000000010000000000000014.00000020.backup" "pg_xlog/RECOVERYHISTORY"<br/>Keep archive history&nbsp;&nbsp;&nbsp;&nbsp;: 000000000000000000000000 and later<br/>running restore&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : OK<br/>Trigger file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: /tmp/pgsql.trigger<br/>Waiting for WAL file&nbsp;&nbsp;&nbsp;&nbsp;: 000000010000000000000014<br/>WAL file path&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : /wal_archives/000000010000000000000014<br/>Restoring to...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : pg_xlog/RECOVERYXLOG<br/>Sleep interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 2 seconds<br/>Max wait interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0 forever<br/>Command for restore&nbsp;&nbsp;&nbsp;&nbsp; : ln -s -f "/wal_archives/000000010000000000000014" "pg_xlog/RECOVERYXLOG"<br/>Keep archive history&nbsp;&nbsp;&nbsp;&nbsp;: 000000000000000000000000 and later<br/>running restore&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : OK<br/><br/>Trigger file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: /tmp/pgsql.trigger<br/>Waiting for WAL file&nbsp;&nbsp;&nbsp;&nbsp;: 000000010000000000000015<br/>WAL file path&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : /wal_archives/000000010000000000000015<br/>Restoring to...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : pg_xlog/RECOVERYXLOG<br/>Sleep interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 2 seconds<br/>Max wait interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0 forever<br/>Command for restore&nbsp;&nbsp;&nbsp;&nbsp; : ln -s -f "/wal_archives/000000010000000000000015" "pg_xlog/RECOVERYXLOG"<br/>Keep archive history&nbsp;&nbsp;&nbsp;&nbsp;: 000000010000000000000014 and later<br/>WAL file not present yet. Checking for trigger file...<br/>WAL file not present yet. Checking for trigger file...<br/>WAL file not present yet. Checking for trigger file...<br/>Trigger file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: /tmp/pgsql.trigger<br/>Waiting for WAL file&nbsp;&nbsp;&nbsp;&nbsp;: 000000010000000000000016<br/>WAL file path&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : /wal_archives/000000010000000000000016<br/>Restoring to...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : pg_xlog/RECOVERYXLOG<br/>Sleep interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 2 seconds<br/>&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;&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;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>Restoring to...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : pg_xlog/RECOVERYXLOG<br/>Sleep interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 2 seconds<br/>Max wait interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0 forever<br/>Command for restore&nbsp;&nbsp;&nbsp;&nbsp; : ln -s -f "/wal_archives/000000010000000000000016" "pg_xlog/RECOVERYXLOG"<br/>Keep archive history&nbsp;&nbsp;&nbsp;&nbsp;: 000000010000000000000014 and later<br/>running restore&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : OK<br/>......<br/>WAL file not present yet. Checking for trigger file...<br/>WAL file not present yet. Checking for trigger file...<br/>......<br/><br/></div></div><br/>10.&nbsp;&nbsp;failover <br/>In warm standby server <br/>touch&nbsp;&nbsp;/tmp/ pgsql.trigger<br/>Tags - <a href="http://www.askwan.com/tags/postgresql/" rel="tag">postgresql</a> , <a href="http://www.askwan.com/tags/warm/" rel="tag">warm</a> , <a href="http://www.askwan.com/tags/standby/" rel="tag">standby</a> , <a href="http://www.askwan.com/tags/pitr/" rel="tag">pitr</a>
]]>
</description>
</item><item>
<link>http://www.askwan.com/use_pgFouine_analyse_postgresql_slow_queries/</link>
<title><![CDATA[use pgFouine analyse postgresql slow queries]]></title> 
<author>askwan &lt;askwan@yahoo.cn&gt;</author>
<category><![CDATA[DataBase]]></category>
<pubDate>Wed, 25 Nov 2009 01:55:55 +0000</pubDate> 
<guid>http://www.askwan.com/use_pgFouine_analyse_postgresql_slow_queries/</guid> 
<description>
<![CDATA[ 
	"pgFouine is a PostgreSQL log analyzer used to generate detailed reports from a PostgreSQL log file. pgFouine can help you to determine which queries you should optimize to speed up your PostgreSQL based application."<br/><br/>you can use syslog or stderr <br/><br/>for example :use syslog<br/><br/>1. edit your /etc/syslog.conf<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">&nbsp;&nbsp;local0.*&nbsp;&nbsp;&nbsp;&nbsp;-/var/log/pgsql</div></div><br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content"><br/>*.info;mail.none;authpriv.none;cron.none;local0.none&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/var/log/messages</div></div><br/><br/><br/>2. edit postgresl.conf<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">log_destination = 'syslog'<br/>silent_mode = on<br/><br/>log_min_duration_statement = 0 <br/>#set to 0&nbsp;&nbsp;log all <br/>#set to -1 ,disable query logging<br/>#set to X(positive integral) ,means to log queries slower than X milliseconds: <br/><br/>log_duration = off<br/>log_statement = 'all'</div></div><br/><br/>3.download pgFouine <br/><a href="http://pgfouine.projects.postgresql.org/index.html" target="_blank">http://pgfouine.projects.postgresql.org/index.html</a><br/><br/>than restart syslogd and postgresql <br/><br/>4. analyse log <br/>./pgfouine.php -file /var/log/postgresql/pgsql > askwan.com.html<br/><br/><a href="http://www.askwan.com/attachment.php?fid=195" target="_blank"><img src="http://www.askwan.com/attachment.php?fid=195" class="insertimage" alt="Open in new window" title="Open in new window" border="0"/></a><br/><br/>use stderr please refer to <a href="http://gkoenig.wordpress.com/2009/02/19/pgfouine-dive-into-postgres-log/" target="_blank">http://gkoenig.wordpress.com/2009/02/19/pgfouine-dive-into-postgres-log/</a><br/>Tags - <a href="http://www.askwan.com/tags/use/" rel="tag">use</a> , <a href="http://www.askwan.com/tags/pgfouine/" rel="tag">pgfouine</a> , <a href="http://www.askwan.com/tags/analyse/" rel="tag">analyse</a> , <a href="http://www.askwan.com/tags/postgresql/" rel="tag">postgresql</a> , <a href="http://www.askwan.com/tags/slow/" rel="tag">slow</a> , <a href="http://www.askwan.com/tags/queries/" rel="tag">queries</a>
]]>
</description>
</item><item>
<link>http://www.askwan.com/use_perl_to_get_timestamp_localtime_strftime/</link>
<title><![CDATA[use perl to get timestamp]]></title> 
<author>askwan &lt;askwan@yahoo.cn&gt;</author>
<category><![CDATA[Scripts]]></category>
<pubDate>Fri, 30 Oct 2009 00:48:08 +0000</pubDate> 
<guid>http://www.askwan.com/use_perl_to_get_timestamp_localtime_strftime/</guid> 
<description>
<![CDATA[ 
	in different&nbsp;&nbsp;context have different value <br/>eg:<br/>saclar context<br/>print scalar (localtime);<br/><br/>then output :<br/>Thu Oct 29 18:50:01 2009<br/><br/>but in list context ;<br/>($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);<br/>$sec&nbsp;&nbsp;&nbsp;&nbsp;0 ~ 59<br/>$min&nbsp;&nbsp;&nbsp;&nbsp;0 ~ 59<br/>$hour&nbsp;&nbsp;0 ~ 23<br/>$mday&nbsp;&nbsp; 1~31<br/>$mon&nbsp;&nbsp;&nbsp;&nbsp; 0 ~ 11<br/>$year&nbsp;&nbsp; after 1900,it passed years<br/>$wday&nbsp;&nbsp;&nbsp;&nbsp;0 ~ 6<br/>$yday&nbsp;&nbsp;&nbsp;&nbsp;0 ~365<br/>$isdst&nbsp;&nbsp; insignificant for me <br/><br/>can use this to get timestamp<br/><textarea name="code" class="php" rows="15" cols="100">#!/usr/bin/perl -w
my ($sec,$min,$hour,$mday,$mon,$year)=(localtime)[0..5];
my ($sec,$min,$hour,$mday,$mon,$year)=($sec,$min,$hour,$mday,$mon+1,$year+1900);
$timestamp=$year."-".$mon."-".$mday." ".$hour.":".$min.":".$sec;
print $timestamp."&#92;n";</textarea><br/>output:<br/>2009-10-29 19:2:40<br/><br/>have some defect ablove,use this <br/><textarea name="code" class="php" rows="15" cols="100">#!/usr/bin/perl -w
my&nbsp;&nbsp;($sec,$min,$hour,$mday,$mon,$year) = (localtime)[0..5];
($sec,$min,$hour,$mday,$mon,$year) = (
&nbsp;&nbsp;&nbsp;&nbsp;sprintf("%02d", $sec),
&nbsp;&nbsp;&nbsp;&nbsp;sprintf("%02d", $min),
&nbsp;&nbsp;&nbsp;&nbsp;sprintf("%02d", $hour),
&nbsp;&nbsp;&nbsp;&nbsp;sprintf("%02d", $mday),
&nbsp;&nbsp;&nbsp;&nbsp;sprintf("%02d", $mon + 1),
&nbsp;&nbsp;&nbsp;&nbsp;$year + 1900);
$timestamp=$year."-".$mon."-".$mday." ".$hour.":".$min.":".$sec;
print $timestamp."&#92;n";</textarea><br/>output:<br/>2009-10-29 19:02:45<br/><br/>you can also use POSIX functions:<br/>eg<br/><textarea name="code" class="php" rows="15" cols="100">#!/usr/bin/perl -w
use POSIX qw(strftime);
$timestamp1= strftime "%Y-%m-%d %H:%M:%S", gmtime;#GMT Zone
$timestamp2 = strftime "%Y-%m-%d %H:%M:%S", localtime;</textarea><br/><br/>output:<br/>2009-10-29 11:10:44<br/>2009-10-29 19:10:44
]]>
</description>
</item><item>
<link>http://www.askwan.com/use_DBD_Pg_to_connect_PostgreSQL_database/</link>
<title><![CDATA[use DBD::Pg to connect PostgreSQL database]]></title> 
<author>askwan &lt;askwan@yahoo.cn&gt;</author>
<category><![CDATA[Scripts]]></category>
<pubDate>Tue, 20 Oct 2009 02:01:50 +0000</pubDate> 
<guid>http://www.askwan.com/use_DBD_Pg_to_connect_PostgreSQL_database/</guid> 
<description>
<![CDATA[ 
	first, install&nbsp;&nbsp;DBI and DBD::Pg module<br/><br/>come next two example I have writen for testing:<br/><br/>example one:<br/><textarea name="code" class="php" rows="15" cols="100">#!/usr/bin/perl -w
#this is an example writen by askwan to insert into somedata to a table 
use DBI;


my $dbh = DBI->connect("DBI:Pg:dbname="askwan.com";host=localhost", "postgres", "postgres", &#123;AutoCommit => 0,'RaiseError' => 1,PrintError => 1&#125;);
# The AutoCommit attribute should always be explicitly set



for(my $i=0;$i<100;$i++)&#123;
# execute INSERT query
my $rows = $dbh->do("INSERT INTO test(id, name) VALUES ('id_$i', 'name_$i')");
print "$i row(s) inserted &#92;n";
&#125;

my $sth = $dbh->prepare("SELECT id, name FROM test");
$sth->execute();

while(my $ref = $sth->fetchrow_hashref()) &#123;
&nbsp;&nbsp;&nbsp;&nbsp;print "$ref->&#123;'id'&#125; is a $ref->&#123;'name'&#125;&#92;n";
&#125;

$dbh->disconnect();</textarea><br/><br/>example two:<br/><textarea name="code" class="php" rows="15" cols="100">#!/usr/bin/perl -w
#this is an example writen by askwan to query some info from PostgreSql
use DBI;

$dbname="askwan";
$host="localhost";
$port="5432";
$username="postgres";
$password="postgres";

$dbh = DBI->connect("dbi:Pg:dbname=$dbname;host=$host;port=$port;",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$username,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$password,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;AutoCommit => 0, RaiseError => 1, PrintError => 0&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );
$sth=$dbh->prepare('select datname,blks_read,blks_hit from pg_stat_database');

$sth->execute();

print sprintf("%-20s%-20s%-20s","datname","blks_read","blks_hit"),"&#92;n";
print "-" x 60 ."&#92;n";

my @data;
my ($datname,$blk_read,$blks_hit);

while(@data=$sth->fetchrow_array()) &#123;
&nbsp;&nbsp;&nbsp;&nbsp; ($datname,$blk_read,$blks_hit)=@data;
&nbsp;&nbsp;&nbsp;&nbsp; print sprintf("%-20s%-20s%-20s","$datname","$blk_read","$blks_hit"),"&#92;n";

&#125;
$dbh->disconnect();</textarea>output :<br/><pre>datname&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; blks_read&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; blks_hit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>------------------------------------------------------------<br/>template1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>template0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>postgres&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;136&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5955&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>askwan&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;124&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7396</pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>Tags - <a href="http://www.askwan.com/tags/%2526%2523039%253B/" rel="tag">&#039;</a> , <a href="http://www.askwan.com/tags/dbd%253Apg%2526%2523039%253Bpostgresql/" rel="tag">dbd:pg&#039;postgresql</a>
]]>
</description>
</item><item>
<link>http://www.askwan.com/debian_net-snmp_compile/</link>
<title><![CDATA[compile net-snmp on debian lenny]]></title> 
<author>askwan &lt;askwan@yahoo.cn&gt;</author>
<category><![CDATA[Oprating System ]]></category>
<pubDate>Wed, 23 Sep 2009 08:16:08 +0000</pubDate> 
<guid>http://www.askwan.com/debian_net-snmp_compile/</guid> 
<description>
<![CDATA[ 
	net-snmp<br/>下载地址：<a href="http://ncu.dl.sourceforge.net/project/net-snmp/net-snmp/5.4.2.1/net-snmp-5.4.2.1.tar.gz" target="_blank">http://ncu.dl.sourceforge.net/project/net-snmp/net-snmp/5.4.2.1/net-snmp-5.4.2.1.tar.gz</a><br/>解压然后编译，编译参数<br/><div class="code">./configure --prefix=/usr/local/net-snmp/ --with-sys-contact=&quot;askwan@askwan.com&quot; --with-sys-location=&quot;pudong shanghai China&quot; --enable-shared --with-default-snmp-version=2 --enable-mfd-rewrites --with-mib-modules=&quot;misc/ipfwacc mibII host disman/event-mib ucd_snmp agent_mibs agentx notification target utilities ucd-snmp/diskio tunnel mibII/mta_sendmail&quot; --with-sysconfdir=&quot;/usr/local/net-snmp/etc/&quot;</div><br/>如编译报错：<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">/usr/bin/ld: cannot find -lperl<br/>collect2: ld returned 1 exit status</div></div><br/>这是缺少libperl-dev开发库,安装上<br/><div class="code">apt-get install libperl-dev</div><br/>然后make ;make install <br/>可以用snmpconf配置snmpd.conf，也可用例子文件<br/><div class="code">cp&nbsp;&nbsp;EXAMPLE.conf /usr/local/net-snmp/etc/snmpd.conf</div><br/>然后根据需要修改此文件<br/><div class="code">com2sec local&nbsp;&nbsp;&nbsp;&nbsp; localhost&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; askwan<br/>com2sec mynetwork 192.168.0.0/24&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;askwan<br/><br/>group MyRWGroup v1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; local<br/>group MyRWGroup v2c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local<br/>group MyRWGroup usm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local<br/>group MyROGroup v1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mynetwork<br/>group MyROGroup v2c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mynetwork<br/>group MyROGroup usm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mynetwork<br/><br/>view all&nbsp;&nbsp;&nbsp;&nbsp;included&nbsp;&nbsp;.1&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; 80<br/>access MyROGroup &quot;&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;any&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; noauth&nbsp;&nbsp;&nbsp;&nbsp;exact&nbsp;&nbsp;all&nbsp;&nbsp;&nbsp;&nbsp;none&nbsp;&nbsp; none<br/>access MyRWGroup &quot;&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;any&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; noauth&nbsp;&nbsp;&nbsp;&nbsp;exact&nbsp;&nbsp;all&nbsp;&nbsp;&nbsp;&nbsp;all&nbsp;&nbsp;&nbsp;&nbsp;none<br/><br/>syslocation shanghai pu dong <br/>syscontact Me askwan@askwan.com</div><br/>启动<br/><div class="code">/usr/local/net-snmp/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a -c /usr/local/net-snmp/etc/snmpd.conf </div><br/><br/>测试<br/><div class="code">snmpwalk -c askwan -v2c 192.168.0.5 if</div><br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">IF-MIB::ifIndex.1 = INTEGER: 1<br/>IF-MIB::ifIndex.2 = INTEGER: 2<br/>IF-MIB::ifDescr.1 = STRING: lo<br/>IF-MIB::ifDescr.2 = STRING: eth0<br/>IF-MIB::ifType.1 = INTEGER: softwareLoopback(24)<br/>IF-MIB::ifType.2 = INTEGER: ethernetCsmacd(6)<br/>....</div></div><br/><br/>---------END------------<br/><br/>Tags - <a href="http://www.askwan.com/tags/debian/" rel="tag">debian</a> , <a href="http://www.askwan.com/tags/net-snmp/" rel="tag">net-snmp</a>
]]>
</description>
</item><item>
<link>http://www.askwan.com/Mysql_replication_Error_Slave_SQL_Running_No/</link>
<title><![CDATA[Mysql replication Error Slave_SQL_Running:No]]></title> 
<author>askwan &lt;askwan@yahoo.cn&gt;</author>
<category><![CDATA[DataBase]]></category>
<pubDate>Tue, 15 Sep 2009 05:20:23 +0000</pubDate> 
<guid>http://www.askwan.com/Mysql_replication_Error_Slave_SQL_Running_No/</guid> 
<description>
<![CDATA[ 
	mysql> show slave status&#92;G<br/>......<br/> Slave_IO_Running: Yes<br/> <span style="color: #FF0000;">Slave_SQL_Running: No</span><br/>......<br/><br/>首先定位同步不成功的原因<br/>查数据库日志<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;若是从主机重启，事物回滚，则<br/><div class="code">mysql&gt; slave stop;<br/>mysql&gt; set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;<br/>mysql&gt; slave start;</div><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;其他网络故障，则<br/>go to master :<br/><pre><br/>mysql> show master status;<br/>+------------------+-----------+--------------+------------------+<br/>&#124; File&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#124; Position&nbsp;&nbsp;&#124; Binlog_Do_DB &#124; Binlog_Ignore_DB &#124;<br/>+------------------+-----------+--------------+------------------+<br/>&#124; mysql-bin.000004 &#124; 244274056 &#124; cada_w&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#124;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124; <br/>+------------------+-----------+--------------+------------------+<br/>1 row in set (0.00 sec)</pre><br/><br/>go to slave ，manual replication <br/><div class="code">mysql&gt;salve stop <br/>mysql&gt; change master to<br/>&gt; master_host=&#039;192.168.0.50&#039;,<br/>&gt; master_user=&#039;askwan&#039;,<br/>&gt; master_password=&#039;askwan.com&#039;,<br/>&gt; master_port=3306,<br/>&gt; master_log_file=localhost-bin.000004&#039;,<br/>&gt; master_log_pos=244274056 ;<br/>1 row in set (0.00 sec)<br/>mysql&gt; slave start;<br/>1 row in set (0.00 sec)</div><br/><br/>then done !<br/><br/>mysql> show slave status&#92;G<br/>......<br/> Slave_IO_Running: Yes<br/> <span style="color: #008000;">Slave_SQL_Running: Yes</span><br/>......<br/><br/><br/><br/><br/>another example:<br/><div class="code">mysql&gt; show slave status&#92;G<br/>*************************** 1. row ***************************<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Slave_IO_State: Waiting for master to send event<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_Host: 192.168.100.88<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_User: slave<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_Port: 3306<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Connect_Retry: 60<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_Log_File: mysql-bin.000097<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Read_Master_Log_Pos: 84519125<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Relay_Log_File: HK1-relay-bin.001040<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Relay_Log_Pos: 8880267<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Relay_Master_Log_File: mysql-bin.000097<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Slave_IO_Running: Yes<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Slave_SQL_Running: No<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replicate_Do_DB: askwan.com<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replicate_Ignore_DB: <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Replicate_Do_Table: <br/>&nbsp;&nbsp;&nbsp;&nbsp; Replicate_Ignore_Table: <br/>&nbsp;&nbsp;&nbsp;&nbsp;Replicate_Wild_Do_Table: <br/>Replicate_Wild_Ignore_Table: <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Last_Errno: 0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Last_Error: Could not parse relay log event entry. The possible reasons are: the master&#039;s binary log is corrupted (you can check this by running &#039;mysqlbinlog&#039; on the binary log), the slave&#039;s relay log is corrupted (you can check this by running &#039;mysqlbinlog&#039; on the relay log), a network problem, or a bug in the master&#039;s or slave&#039;s MySQL code. If you want to check the master&#039;s binary log or slave&#039;s relay log, you will be able to know their names by issuing &#039;SHOW SLAVE STATUS&#039; on this slave.<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Skip_Counter: 0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Exec_Master_Log_Pos: 67663733<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Relay_Log_Space: 30399576<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Until_Condition: None<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Until_Log_File: <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Until_Log_Pos: 0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Master_SSL_Allowed: No<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Master_SSL_CA_File: <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Master_SSL_CA_Path: <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_SSL_Cert: <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_SSL_Cipher: <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Master_SSL_Key: <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Seconds_Behind_Master: NULL<br/>1 row in set (0.00 sec)</div><br/><br/>first stop slave replication:<br/><div class="code">mysql&gt; stop slave;<br/>Query OK, 0 rows affected (0.04 sec)</div><br/><br/>change master host info:<br/><div class="code">mysql&gt; change master to master_host=&#039;192.168.100.88&#039;,master_user=&#039;slave&#039;,master_password=&#039;askwan.com&#039;,master_port=3306,master_log_file=&#039;mysql-bin.000097&#039;,master_log_pos=67663733;</div><br/><br/>last step ,start replication:<br/><br/><div class="code">mysql&gt; start slave;<br/>Query OK, 0 rows affected (0.00 sec)</div><br/><br/>check all right or not :<br/><div class="code">mysql&gt; show slave status&#92;G&nbsp;&nbsp;</div><br/>.......<br/>Slave_IO_Running: Yes<br/>Slave_SQL_Running: Yes<br/>.......<br/><br/><br/>Tags - <a href="http://www.askwan.com/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.askwan.com/tags/replication/" rel="tag">replication</a> , <a href="http://www.askwan.com/tags/error/" rel="tag">error</a>
]]>
</description>
</item><item>
<link>http://www.askwan.com/perl_DBD_Oracle_connect_oracle/</link>
<title><![CDATA[use DBD::Oracle connect oracle database]]></title> 
<author>askwan &lt;askwan@yahoo.cn&gt;</author>
<category><![CDATA[Scripts]]></category>
<pubDate>Thu, 10 Sep 2009 12:40:07 +0000</pubDate> 
<guid>http://www.askwan.com/perl_DBD_Oracle_connect_oracle/</guid> 
<description>
<![CDATA[ 
	the first way:<br/><textarea name="code" class="php" rows="15" cols="100">#!/usr/bin/perl -w
use strict;
use DBI;
my $dbh = DBI->connect( 'dbi:Oracle:askwan', 'scott', 'scott',&#123; RaiseError => 1, AutoCommit => 0 &#125; );

my $sql = qq&#123; SELECT 'askwan.com' FROM DUAL &#125;;

my $sth = $dbh->prepare( $sql );

$sth->execute(&nbsp;&nbsp;);

while ( my($String) = $sth->fetchrow_array) &#123;
&nbsp;&nbsp; print $String, "&#92;n";
&#125;
$dbh->disconnect(&nbsp;&nbsp;);</textarea><br/><br/>the second way:<br/><textarea name="code" class="php" rows="15" cols="100">#!/usr/bin/perl -w
use strict;
use DBI;
my $dbh = DBI->connect( 'dbi:Oracle:askwan', 'scott', 'scott',&#123; RaiseError => 1, AutoCommit => 0 &#125; );

print $dbh->selectrow_array(qq&#123; SELECT 'askwan.com' FROM DUAL &#125;);

$dbh->disconnect(&nbsp;&nbsp;);</textarea><br/><br/>----------END-----------<br/>Tags - <a href="http://www.askwan.com/tags/perl/" rel="tag">perl</a> , <a href="http://www.askwan.com/tags/dbd/" rel="tag">dbd</a> , <a href="http://www.askwan.com/tags/oracle/" rel="tag">oracle</a>
]]>
</description>
</item><item>
<link>http://www.askwan.com/oracle_Temporary_tablespace_boom_unexpectedly/</link>
<title><![CDATA[oracle temporary tablespace boom unexpectedly]]></title> 
<author>askwan &lt;askwan@yahoo.cn&gt;</author>
<category><![CDATA[Oprating System ]]></category>
<pubDate>Mon, 07 Sep 2009 00:38:52 +0000</pubDate> 
<guid>http://www.askwan.com/oracle_Temporary_tablespace_boom_unexpectedly/</guid> 
<description>
<![CDATA[ 
	临时表空间用途：<br/>INDEX CREATE ,INDEX REBUILD,ORDER BY ,GROUP BY, DISTINCT,Analyze,UNION, Sort-Merge etc.. <br/>上面这些操作均会用到临时表空间<br/><br/>临时表空间重建步骤：<br/>比如临时表空间一直增大，导致系统磁盘空间吃紧，考虑重建<br/>1 定位当前临时表空间位置<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">SQL> SELECT FILE_NAME,TABLESPACE_NAME FROM DBA_TEMP_FILES;<br/> <br/>FILE_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;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TABLESPACE_NAME<br/>-------------------------------------------------------------------------------- ------------------------------<br/>/u01/oracle/oradata/askwan/temp01.dbf&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TEMP</div></div><br/> <br/>2 创建临时表空间TEMP02<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">SQL> CREATE TEMPORARY TABLESPACE TEMP02 TEMPFILE '/u01/oracle/oradata/askwan/temp02.dbf' <br/>SIZE 100M REUSE AUTOEXTEND ON NEXT 512K MAXSIZE UNLIMITED;<br/> <br/>Tablespace created</div></div><br/><br/>review:<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">SQL>&nbsp;&nbsp;SELECT FILE_NAME,TABLESPACE_NAME FROM DBA_TEMP_FILES;<br/> <br/>FILE_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;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TABLESPACE_NAME<br/>-------------------------------------------------------------------------------- ------------------------------<br/>/u01/oracle/oradata/askwan/temp01.dbf&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TEMP<br/>/u01/oracle/oradata/askwan/temp02.dbf&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TEMP02<br/><br/>have created successfull.</div></div><br/><br/>3 改变缺省临时表空间为TEMP02<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP02;<br/> <br/>Database altered</div></div><br/><br/>4 .删除原缺省表空间temp<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">SQL> drop tablespace temp including contents and datafiles;<br/> <br/>Tablespace dropped</div></div><br/><br/>5.创建新表空间temp<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">SQL> CREATE TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/oracle/oradata/askwan/temp.dbf' <br/>SIZE 100M REUSE AUTOEXTEND ON NEXT 512K MAXSIZE UNLIMITED;<br/><br/>Tablespace created</div></div><br/><br/>6. 改变缺省表空间<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content"> SQL> alter database default temporary tablespace temp;<br/> <br/>Database altered</div></div><br/><br/>7.删除中间过程表空间TEMP02<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">SQL> drop tablespace temp02 including contents and datafiles;<br/> <br/>Tablespace dropped</div></div><br/><br/>8.重新指定用户临时表空间<br/><div class="quote"><div class="quote-title">Quotation</div><div class="quote-content">SQL> alter user ASKWAN temporary tablespace temp;<br/><br/>User altered</div></div><br/><br/>涉及临时文件相关操作<br/>eg.<br/>alter database tempfile '/u01/oracle/oradata/askwan/temp.dbf'&nbsp;&nbsp;autoextend off;<br/>alter database tempfile '/u01/oracle/oradata/askwan/temp.dbf'&nbsp;&nbsp;resize 300M;<br/>alter database tempfile ''/u01/oracle/oradata/askwan/temp.dbf' autoextend on;<br/>
]]>
</description>
</item><item>
<link>http://www.askwan.com/parse_apache_log_with_perl/</link>
<title><![CDATA[simple way to parse apache log with perl to find top 10 clients]]></title> 
<author>askwan &lt;askwan@yahoo.cn&gt;</author>
<category><![CDATA[Scripts]]></category>
<pubDate>Fri, 04 Sep 2009 07:03:23 +0000</pubDate> 
<guid>http://www.askwan.com/parse_apache_log_with_perl/</guid> 
<description>
<![CDATA[ 
	<textarea name="code" class="php" rows="15" cols="100">#!/usr/bin/perl -w
$file=shift;
open(FD,"$file");
while(<FD>)&#123;
&nbsp;&nbsp;&nbsp;&nbsp;m/(&#92;d&#123;1,3&#125;&#92;.&#92;d&#123;1,3&#125;&#92;.&#92;d&#123;1,3&#125;&#92;.&#92;d&#123;1,3&#125;)/;
&nbsp;&nbsp;&nbsp;&nbsp;$IP&#123;$1&#125;++;
&#125;

print "Client IPs&#92;t&#92;tNum Of Visits&#92;n";
foreach ( sort &#123; $IP&#123; $b &#125; <=> $IP&#123; $a &#125; &#125; keys( %IP) ) &#123;
&nbsp;&nbsp; print "$_&#92;t&#92;t", $IP&#123; $_ &#125;, "&#92;n";
&nbsp;&nbsp; ++$a;
&nbsp;&nbsp; exit 0 if $a>9;
&nbsp;&nbsp; &#125;
</textarea><br/><br/>usage and output:<br/><div class="code">./parse_apache.pl&nbsp;&nbsp; &#91;APACHE LOGFILE&#93;</div># perl parse_apache.pl access_askwan_com_log<br/>Client IPs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Num Of Visits<br/>192.168.11.8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1794924<br/>192.168.11.60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 80887<br/>192.168.11.9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;34403<br/>192.168.11.50&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 18026<br/>192.168.11.196&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8379<br/>192.168.11.201&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1353<br/>192.168.11.155&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1041<br/>192.168.21.156&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;449<br/>192.168.21.161&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;163<br/>192.168.12.2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;84<br/><br/>-------------end--------------<br/>Tags - <a href="http://www.askwan.com/tags/parse/" rel="tag">parse</a> , <a href="http://www.askwan.com/tags/apache/" rel="tag">apache</a> , <a href="http://www.askwan.com/tags/logperl/" rel="tag">logperl</a>
]]>
</description>
</item><item>
<link>http://www.askwan.com/Linux_Kernel_sock_sendpage_NULL_Pointer_Dereference_Vulnerability/</link>
<title><![CDATA[linux的内核漏洞]]></title> 
<author>askwan &lt;askwan@yahoo.cn&gt;</author>
<category><![CDATA[Oprating System ]]></category>
<pubDate>Fri, 21 Aug 2009 23:39:17 +0000</pubDate> 
<guid>http://www.askwan.com/Linux_Kernel_sock_sendpage_NULL_Pointer_Dereference_Vulnerability/</guid> 
<description>
<![CDATA[ 
	<strong>“Linux Kernel 'sock_sendpage()' NULL Pointer Dereference Vulnerability”&nbsp;&nbsp;</strong><br/><br/>标准化代号 CVE-2009-2692<br/><br/>这漏洞恐怕是linux历史上非常值得“怀念”的了 <br/>如今<a href="http://www.securityfocus.com/bid/36038/exploit" target="_blank">exploit</a>工具早已发布出来 还是有不少人没有引起重视啊 <br/>我安装的几台debian lenny 5.0.1和几台RHEL5.3也不幸名列其中 加上我自己的Ubuntu9.04<br/>几乎可以说是全部“中招”了 呵呵<br/><br/><a href="http://www.askwan.com/attachment/200908/1250898142_9451fbc9.txt" target="_blank">受影响linux系统列表</a><br/><br/>在各种<a href="http://www.securityfocus.com/bid/36038/solution" target="_blank">solutions</a>也都公布出来的今天 <br/>我想我们应该只关心两个问题<br/>1.你管理的linux服务器在这个列表中吗 ？<br/>2.你已经采取了补救措施了吗？<br/><br/>
]]>
</description>
</item><item>
<link>http://www.askwan.com/YSlow_Add_Future_Expires_Headers/</link>
<title><![CDATA[Add Future Expires Headers]]></title> 
<author>askwan &lt;askwan@yahoo.cn&gt;</author>
<category><![CDATA[Oprating System ]]></category>
<pubDate>Fri, 21 Aug 2009 08:40:09 +0000</pubDate> 
<guid>http://www.askwan.com/YSlow_Add_Future_Expires_Headers/</guid> 
<description>
<![CDATA[ 
	无它 可以增加YSlow得分<br/> <br/>apache配置文件http.conf 或者 .htaccess文件 根据需要自行添加<br/><br/><div class="code"><br/>&lt;FilesMatch &quot;&#92;.(ico&#124;pdf&#124;flv&#124;jpg&#124;jpeg&#124;png&#124;gif&#124;js&#124;css&#124;swf)$&quot;&gt; <br/>Header set Expires &quot;Fri, 08 Aug 2010 08:08:08 GMT&quot; <br/>&lt;/FilesMatch&gt;<br/></div><br/><br/>注意：<br/><br/>1。若有很多静态文件，如ico,jpg,css,js,gif之类的文件长时间不会改变或者更新的，用此方法甚好<br/><br/>2。若这类文件更新比较频繁，那过期时间就设置得距离现在短一点。<br/><br/><br/><br/>Tags - <a href="http://www.askwan.com/tags/yslow/" rel="tag">yslow</a> , <a href="http://www.askwan.com/tags/expires/" rel="tag">expires</a> , <a href="http://www.askwan.com/tags/headers/" rel="tag">headers</a>
]]>
</description>
</item>
</channel>
</rss>