﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-我的ITblog我作主　　关注→　『伊波拉』→　测试　SzDlinXie- ITblog　　  　　   </title><link>http://www.cnitblog.com/szdlinxie/</link><description>·√·  本ITblog站点记录相关的软件技术文档、网络技术杂志、测试技术杂谈等技术文档的管理站点.联系方式：MSN：dowling@sunlike.cn   QQ:94595885</description><language>zh-cn</language><lastBuildDate>Mon, 04 May 2026 20:57:03 GMT</lastBuildDate><pubDate>Mon, 04 May 2026 20:57:03 GMT</pubDate><ttl>60</ttl><item><title>第8号酷尚服饰专卖空间</title><link>http://www.cnitblog.com/szdlinxie/archive/2009/02/20/54760.html</link><dc:creator>szdlinxie</dc:creator><author>szdlinxie</author><pubDate>Fri, 20 Feb 2009 05:56:00 GMT</pubDate><guid>http://www.cnitblog.com/szdlinxie/archive/2009/02/20/54760.html</guid><wfw:comment>http://www.cnitblog.com/szdlinxie/comments/54760.html</wfw:comment><comments>http://www.cnitblog.com/szdlinxie/archive/2009/02/20/54760.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.cnitblog.com/szdlinxie/comments/commentRss/54760.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/szdlinxie/services/trackbacks/54760.html</trackback:ping><description><![CDATA[<p><span style="FONT-SIZE: 18pt"><strong><font style="FONT-SIZE: 24pt; BACKGROUND-COLOR: #f8dddd" face=幼圆 color=#0060bf>&#8220;第8号酷尚服饰专卖空间&#8221;<br><br></font></strong></span><strong><font style="FONT-SIZE: 18pt; BACKGROUND-COLOR: #f8dddd" face=幼圆 color=#0060bf size=6>我的淘宝服饰店开张咯<br><br><a href="http://shop57055019.taobao.com/">http://shop57055019.taobao.com</a> <br><br>店铺专用域名： <a href="http://www.d8hcool.cn/">www.d8hcool.cn</a><br></font></strong><br><strong><font color=#0060bf><font style="BACKGROUND-COLOR: #f8dddd"><font face=幼圆><span style="FONT-SIZE: 18pt">&#8220;第8号酷尚服饰专卖空间&#8221;刚开张，<br><br>希望新老朋友多多光顾关照&#8220;第8号酷尚服饰&#8221;。<br><br>保证产品质量，多买多优惠，谢谢光顾！<br><br>联系电话：15958194984<br><br>联系QQ号：983815681<br><br>旺旺: dowlingxie </span></font></font></font></strong><a href="http://amos1.taobao.com/msg.ww?v=2&amp;uid=dowlingxie&amp;s=1" target=_blank><img alt=点击这里给我发消息 src="http://amos1.taobao.com/online.ww?v=2&amp;uid=dowlingxie&amp;s=1" border=0></a> </p>
<img src ="http://www.cnitblog.com/szdlinxie/aggbug/54760.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/szdlinxie/" target="_blank">szdlinxie</a> 2009-02-20 13:56 <a href="http://www.cnitblog.com/szdlinxie/archive/2009/02/20/54760.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>.net读写INI文件的函数</title><link>http://www.cnitblog.com/szdlinxie/archive/2008/12/31/53298.html</link><dc:creator>szdlinxie</dc:creator><author>szdlinxie</author><pubDate>Wed, 31 Dec 2008 06:10:00 GMT</pubDate><guid>http://www.cnitblog.com/szdlinxie/archive/2008/12/31/53298.html</guid><wfw:comment>http://www.cnitblog.com/szdlinxie/comments/53298.html</wfw:comment><comments>http://www.cnitblog.com/szdlinxie/archive/2008/12/31/53298.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/szdlinxie/comments/commentRss/53298.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/szdlinxie/services/trackbacks/53298.html</trackback:ping><description><![CDATA[<p style="WORD-BREAK: break-all; LINE-HEIGHT: 12pt"><span lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Int32, ByVal lpFileName As String) As Int32<br>&nbsp;&nbsp;&nbsp; Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Int32<o:p></o:p></span></p>
<p style="WORD-BREAK: break-all; LINE-HEIGHT: 12pt"><span lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;&nbsp;&nbsp; Public Function GetINI(ByVal Section As String, ByVal AppName As String, ByVal lpDefault As String, ByVal FileName As String) As String<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim Str As String = LSet(Str, 256)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GetPrivateProfileString(Section, AppName, lpDefault, Str, Len(Str), FileName)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return Microsoft.VisualBasic.Left(Str, InStr(Str, Chr(0)) - 1)<br>&nbsp;&nbsp;&nbsp; End Function<br>&nbsp;&nbsp;&nbsp; Public Function WriteINI(ByVal Section As String, ByVal AppName As String, ByVal lpDefault As String, ByVal FileName As String) As Long<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WriteINI = WritePrivateProfileString(Section, AppName, lpDefault, FileName)<br>&nbsp;&nbsp;&nbsp; End Function<o:p></o:p></span></p>
<br>写:<br>
<p style="WORD-BREAK: break-all; LINE-HEIGHT: 12pt"><span lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Try<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim path As String<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; path = Application.StartupPath + "\文件名.ini"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WriteINI("aa", "a1", 内容, path)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Catch ex As Exception<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Try<br>&nbsp;&nbsp;&nbsp; End Sub<br><o:p><br>读:<br><span>Dim path As String<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; path = Application.StartupPath + "\文件名.ini"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; textbox.Text = GetINI("aa", "a1", "", path)<br><br></span><br></o:p></span></p>
<img src ="http://www.cnitblog.com/szdlinxie/aggbug/53298.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/szdlinxie/" target="_blank">szdlinxie</a> 2008-12-31 14:10 <a href="http://www.cnitblog.com/szdlinxie/archive/2008/12/31/53298.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>批量插入数据MYSQL</title><link>http://www.cnitblog.com/szdlinxie/archive/2008/10/10/50062.html</link><dc:creator>szdlinxie</dc:creator><author>szdlinxie</author><pubDate>Fri, 10 Oct 2008 09:46:00 GMT</pubDate><guid>http://www.cnitblog.com/szdlinxie/archive/2008/10/10/50062.html</guid><wfw:comment>http://www.cnitblog.com/szdlinxie/comments/50062.html</wfw:comment><comments>http://www.cnitblog.com/szdlinxie/archive/2008/10/10/50062.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/szdlinxie/comments/commentRss/50062.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/szdlinxie/services/trackbacks/50062.html</trackback:ping><description><![CDATA[&nbsp;
<p><span>@echo off</span></p>
<p><span>cls</span></p>
<p>&nbsp;</p>
<p><span>set CLASSPATH=..\api\jogre.jar</span></p>
<p><span>set CLASSPATH=%CLASSPATH%;.</span></p>
<p><span>set CLASSPATH=%CLASSPATH%;classes</span></p>
<p><span>set CLASSPATH=%CLASSPATH%;lib\dom4j.jar</span></p>
<p>&nbsp;</p>
<p><span>java org.jogre.server.JogreServer</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div align=center>
<table cellSpacing=1 cellPadding=0 width="100%" border=0>
    <tbody>
        <tr>
            <td>
            <p align=left><span>建表<span><br>[code]<br>create database con_test;<br>use con_test;<br>create table test(id int not null,txt varchar (70),primary key (id),index (id));<br>[/code]<br><br></span>就两个字段，<span>id</span>加索引。<span><br><br></span>用<span>java</span>程序给表循环<span>10</span>万次插入纪录，<span>id(</span>循环次数<span>) </span>和 内容<span>(</span>这条记录是第<span>=xx)<br><br><br>InsertTestMysql.java<br><br>[code]<br>import java.lang.*;<br>import java.sql.*;<br><br>public class InsertTestMysql{<br>&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String [] args){&nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; java.util.Date now_start = new java.util.Date();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; long start_time=now_start.getTime();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int st = 100000;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String str,info;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String db="org.gjt.mm.mysql.Driver";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String host="jdbc:mysql://192.168.1.35/test";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String user="root";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String passwd="root";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Connection con=null;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Class.forName(db).newInstance();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch(Exception e){<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println("</span>加载驱动失败<span>:"+db);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; con=DriverManager.getConnection(host,user,passwd);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; con.setAutoCommit(false);//</span>关闭事务自动提交<span><br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i=1;i&lt;=st;i++){<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<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; info = "</span>这条记录是第<span>=";<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; info = info.concat(java.lang.Integer.toString(i));<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; str = "insert into test (id,txt) values(?,?);";<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PreparedStatement pstmt = con.prepareStatement(str);<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pstmt.setInt(1,i);<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pstmt.setString(2,info);<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pstmt.executeUpdate();<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; con.commit();//</span>语句执行完毕，提交本事务<span><br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; con.close();<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; catch(Exception e) {<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;System.out.println(e);<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; }<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; java.util.Date now_end = new java.util.Date();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; long end_time=now_end.getTime();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; long use_time=end_time-start_time;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println("&lt;&lt;---</span>本页生成耗时<span>["+use_time+"]</span>毫秒<span>("+((double)use_time)/1000+"</span>秒<span>)---&gt;&gt;");<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println("\n&lt;&lt;---</span>共插入记录<span>"+st+"</span>条<span>--&gt;&gt;");<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>}<br>[/code]<br><br><br></span>在不同版本的<span>jdbc</span>下，表现不同。<span><br><br>jdbc <st1:chsdate w:st="on" Year="1899" Month="12" Day="30" IsLunarDate="False" IsROCDate="False">3.1.7</st1:chsdate>, 12770,12778 </span>插入这个数目时，程序退出，中文正常。<span><br>jdbc 3.1.12 12000 </span>插入这个数目时，程序退出，中文正常。<span><br><br></span>均出现以下提示：<span><br>"Exception in thread "main" java.lang.OutOfMemoryError: Java heap space"<br>&#8220;Java </span>堆 空间 错误<span>&#8221;</span>，可能是我机器内存不够。但用<span>3.10</span>系列<span>jdbc</span>就正常。<span><br><br>jdbc 3.0.16-ga 10</span>万记录正常，中文正常。<span><br>jdbc 3.0.10 10</span>万记录成功，但中文错误。<span><br><br></span>使用<span>3.1</span>系列<span>jdbc</span>，程序运行后，机器剩余物理内存很快就成了<span>40xxKB</span>了。<span><br><br></span>这个，也可能是<span>jdbc3.1</span>系列需要内存大，我机器内存不足。<span><br><br></span>明天再去同学的<span>AMD64 <st1:chmetcnv w:st="on" UnitName="m" SourceValue="512" HasSpace="False" Negative="False" NumberType="1" TCSC="0">512M</st1:chmetcnv> RAM </span>机器测试。<span><br><br><br></span></span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p align=left>&nbsp;</p>
<div align=center>
<table cellSpacing=1 cellPadding=0 width="95%" border=0>
    <tbody>
        <tr>
            <td>
            <p align=left><span>jdbc <st1:chsdate w:st="on" Year="1899" Month="12" Day="30" IsLunarDate="False" IsROCDate="False">3.0.16</st1:chsdate>-ga </span><span>唯一这个正常的，测试结果为：<span><br><br>[code]<br>D:\Program Files\test\db_test&gt;java InsertTestMysql<br>&lt;&lt;---</span>本页生成耗时<span>[98582]</span>毫秒<span>(98.582</span>秒<span>)---&gt;&gt;<br><br>&lt;&lt;---</span>共插入记录<span>100000</span>条<span>--&gt;&gt;<br>[/code]</span></span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p align=left>&nbsp;</p>
<div align=center>
<table cellSpacing=1 cellPadding=0 width="95%" border=0>
    <tbody>
        <tr>
            <td>
            <p align=left><span>前几天又测试了下，用开源的<span>jdts </span>的<span>jdbc </span>连接<span>ms-sql server 2000&nbsp;&nbsp;sp3 </span>其他同上，测试结果惨不忍睹：<span><br><br>[code]<br>D:\dev\java\src\ts\Ms-Sql&gt;java InsertTestMssql<br>&lt;&lt;---</span>本页生成耗时<span>[1746681]</span>毫秒<span>(1746.681</span>秒<span>)---&gt;&gt;<br><br>&lt;&lt;---</span>共插入记录<span>100000</span>条<span>--&gt;&gt;<br>[/code]<br><br><br></span>因为<span>MicorSoft</span>官方的<span>jdbc</span>不支持手动提交，因此用开源<span>jdts</span>的<span>,</span>反正官方测试报告说<span>jdts</span>性能在<span>ms-sql</span>的<span>java</span>驱动里性能最好。<span><br><br><br></span></span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p align=left>&nbsp;</p>
<div align=center>
<table cellSpacing=1 cellPadding=0 width="95%" border=0>
    <tbody>
        <tr>
            <td>
            <p align=left><span>把<span>insert </span>语句注释掉， 看你的程序运行<span>10</span>次是否会正常</span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p align=left>&nbsp;</p>
<div align=center>
<table cellSpacing=1 cellPadding=0 width="95%" border=0>
    <tbody>
        <tr>
            <td>
            <p align=left><span>--&gt;<br>Error</span><span>即是<span>JVM</span>的問題<span>,</span>大概是<span>garbage collection</span>太慢<span>:roll:<br><br></span>試試每<span>10000</span>條作一次<span>garbage collection </span>看看<span>:roll:<br><br>--&gt;<br></span>這句每一次作了<span>3</span>個物件<span>,</span>改一個看看<span><br><br><br></span></span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p align=left>&nbsp;</p>
<div align=center>
<table cellSpacing=1 cellPadding=0 width="95%" border=0>
    <tbody>
        <tr>
            <td>
            <p align=left><span>--&gt;<br><br></span><span>但是配合<st1:chsdate w:st="on" Year="1899" Month="12" Day="30" IsLunarDate="False" IsROCDate="False"><span>3.0.16</span></st1:chsdate>和<span>3.0.10 </span>都没问题。<span><br><br><br></span>我也曾设置过，每执行<span>1000</span>次就提交一次，照样是用<span>3.1</span>的驱动出问题。还是<span>1w2</span>时候。</span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p align=left>&nbsp;</p>
<div align=center>
<table cellSpacing=1 cellPadding=0 width="95%" border=0>
    <tbody>
        <tr>
            <td>
            <p align=left><span>事务太长了，每插入一条就<span>commit</span>一次；偶插入过<span>3</span>千万条，没有问题的</span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p align=left>&nbsp;</p>
<div align=center>
<table cellSpacing=1 cellPadding=0 width="95%" border=0>
    <tbody>
        <tr>
            <td>
            <p align=left><span>昨天，用<st1:chsdate w:st="on" Year="1899" Month="12" Day="30" IsLunarDate="False" IsROCDate="False"><span>3.1.12</span></st1:chsdate>驱动，在同学的<span>AMD 64 + <st1:chmetcnv w:st="on" UnitName="m" SourceValue="512" HasSpace="False" Negative="False" NumberType="1" TCSC="0">512M</st1:chmetcnv> RAM </span>上测试了，<span>2W</span>记录，使用<span>java -Xmx<st1:chmetcnv w:st="on" UnitName="m" SourceValue="64" HasSpace="False" Negative="False" NumberType="1" TCSC="0">64m</st1:chmetcnv> -Xmx<st1:chmetcnv w:st="on" UnitName="m" SourceValue="128" HasSpace="False" Negative="False" NumberType="1" TCSC="0">128m</st1:chmetcnv> </span>参数运行，可以顺利通过。<span><br><br></span>但<span>10W</span>记录，照样完蛋。机器消耗的总内存<span>(</span>物理<span>+</span>交换文件<span>)</span>达到<span>1.4GB </span>后，因为空间不够，自动中止。</span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p align=left>&nbsp;</p>
<div align=center>
<table cellSpacing=1 cellPadding=0 width="95%" border=0>
    <tbody>
        <tr>
            <td>
            <p align=left><span>如果直接插入而不用事务机制呢？</span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p align=left>&nbsp;</p>
<div align=center>
<table cellSpacing=1 cellPadding=0 width="95%" border=0>
    <tbody>
        <tr>
            <td>
            <p align=left><span>--&gt;<br><br></span><span>我每次测试，首先就是默认的自动提交<span>(</span>每语句<span>)</span>，用<span>3.1</span>驱动还是出错。<span><br><br></span>当记录数目小到能正常完成时，自动提交耗时是一次事务的<span>10</span>倍时间（记录不太多时，大于<span>1W</span>，差距缩小到<span>2~3</span>倍）。<span><br><br></span>自动提交<span>:<br>[code]<br>## </span>默认<span><br>D:\Program Files\test\db_test&gt;java InsertTestMysql<br>&lt;&lt;---</span>本页生成耗时<span>[43693]</span>毫秒<span>(43.693</span>秒<span>)---&gt;&gt;<br><br>&lt;&lt;---</span>共插入记录<span>1000</span>条<span>--&gt;&gt;<br>[/code]<br><br></span>一次事务<span>:<br>[code]<br>## </span>控制<span>COMMIT,</span>一次性提交<span><br>D:\Program Files\test\db_test&gt;java InsertTestMysql<br>&lt;&lt;---</span>本页生成耗时<span>[3846]</span>毫秒<span>(3.846</span>秒<span>)---&gt;&gt;<br><br>&lt;&lt;---</span>共插入记录<span>1000</span>条<span>--&gt;&gt;<br>[/code]<br><br><br></span></span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p align=left>&nbsp;</p>
<div align=center>
<table cellSpacing=1 cellPadding=0 width="95%" border=0>
    <tbody>
        <tr>
            <td>
            <p align=left><span>没问题啊，。我们每天都通过ｊａｖａ程序插入几十万条数据做测试，都可以的</span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p align=left>&nbsp;</p>
<div align=center>
<table cellSpacing=1 cellPadding=0 width="95%" border=0>
    <tbody>
        <tr>
            <td>
            <p align=left><span>//</span><span>用<span>mysql</span>自己的驱动程序，下面的测试程序插入<span>100000</span>条记录，结果是：<span><br>//&lt;&lt;---</span>本页生成耗时<span>[82781]</span>毫秒<span>(82.781</span>秒<span>)---&gt;&gt;<br>//&lt;&lt;---</span>共插入记录<span>100000</span>条<span>--&gt;&gt;<br>import java.sql.*;<br><br>public class InsertTestMysql {<br>&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String[] args) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; java.util.Date now_start = new java.util.Date();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; long start_time = now_start.getTime();<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int st = 100000;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String db = "com.mysql.jdbc.Driver";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String host = "jdbc:mysql://192.168.2.108/develop";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String user = "whl";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String passwd = "MVu9H370uG";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Connection con = null;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Class.forName(db).newInstance();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception e) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println("</span>加载驱动失败<span>:" + db);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; con = DriverManager.getConnection(host, user, passwd);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PreparedStatement pstmt = con.prepareStatement("insert into test (id,txt) values(?,?);");<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 1; i &lt;= st; i++) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pstmt.setInt(1, i);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pstmt.setString(2, "</span>这条记录是第<span>=" + i);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pstmt.executeUpdate();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; con.close();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception e) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(e);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; java.util.Date now_end = new java.util.Date();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; long end_time = now_end.getTime();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; long use_time = end_time - start_time;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println("&lt;&lt;---</span>本页生成耗时<span>[" + use_time + "]</span>毫秒<span>("<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + ((double) use_time) / 1000 + "</span>秒<span>)---&gt;&gt;");<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println("\n&lt;&lt;---</span>共插入记录<span>" + st + "</span>条<span>--&gt;&gt;");<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>}</span></span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p align=left><span><a href="http://pigdogyourmother.ycool.com/post.1723176.html"><strong><span>MySQL</span></strong><strong><span><span>存储过程资料收集</span></span></strong></a></span></p>
<p align=left>&nbsp;</p>
<p align=left><strong><span>表<span>A </span></span></strong></p>
<table cellSpacing=1 cellPadding=0 width=542 border=0>
    <tbody>
        <tr>
            <td>
            <table cellPadding=0 width=535 border=0>
                <tbody>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><strong><span>声明</span></strong></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><strong><span>描述</span></strong></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>CREATE PROCEDURE</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>建立一个存放在<span>MySQL</span>数据库的表格的存储过程。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>CREATE FUNCTION</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>建立一个用户自定义的函数，尤其是返回数据的存储过程。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>ALTER PROCEDURE</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>更改用<span>CREATE PROCEDURE </span>建立的预先指定的存储过程，其不会影响相关存储过程或存储功能。<span>.</span></span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>ALTER FUNCTION</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>更改用<span>CREATE FUNCTION </span>建立的预先指定的存储过程，其不会影响相关存储过程或存储功能。<span>.</span></span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>DROP PROCEDURE</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>从<span>MySQL</span>的表格中删除一个或多个存储过程。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>DROP FUNCTION</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>从<span>MySQL</span>的表格中删除一个或多个存储函数。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>SHOW CREATE PROCEDURE</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>返回使用<span>CREATE PROCEDURE </span>建立的预先指定的存储过程的文本。这一声明是<span>SQL:2003</span>规范的一个<span>MySQL</span>扩展。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>SHOW CREATE FUNCTION</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>返回使用<span>CREATE &nbsp;FUNCTION</span>建立的预先指定的存储过程的文本。这一声明是<span>SQL:2003</span>规范的一个<span>MySQL</span>扩展。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>SHOW PROCEDURE STATUS</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>返回一个预先指定的存储过程的特性，包括名称、类型、建立者、建立日期、以及更改日期。这一声明是<span>SQL:2003</span>规范的一个<span>MySQL</span>扩展。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>SHOW FUNCTION STATUS</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>返回一个预先指定的存储函数的特性，包括名称、类型、建立者、建立日期、以及更改日期。这一声明是<span>SQL:2003</span>规范的一个<span>MySQL</span>扩展。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>CALL</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>调用一个使用<span>CREATE PROCEDURE</span>建立的预先指定的存储过程。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>BEGIN ... END</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>包含一组执行的多声明。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>DECLARE</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>用于指定当地变量、环境、处理器，以及指针。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>SET</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>用于更改当地和全局服务器变量的值。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>SELECT ... INTO</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>用于存储显示变量的纵列。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>OPEN</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>用于打开一个指针。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>FETCH</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>使用特定指针来获得下一列。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>CLOSE</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>用于关闭和打开指针。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>IF</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>一个<span>An if-then-else-end if </span>声明。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>CASE ... WHEN</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>一个<span> case</span>声明的结构</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><st1:place w:st="on"><span>LOOP</span></st1:place></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>一个简单的循环结构；可以使用<span>LEAVE </span>语句来退出。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>LEAVE</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>用于退出<span>IF</span>，<span>CASE</span>，<span>LOOP</span>，<span>REPEAT</span>以及<span>WHILE </span>语句。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>ITERATE</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>用于重新开始循环。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>REPEAT</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>在结束时测试的循环。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>WHILE</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>在开始时测试的循环。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td vAlign=top width=172>
                        <p align=left><span>RETURNS</span></p>
                        </td>
                        <td vAlign=top width=349>
                        <p align=left><span>返回一个存储过程的值。</span></p>
                        </td>
                    </tr>
                </tbody>
            </table>
            <p align=left></p>
            </td>
        </tr>
    </tbody>
</table>
<p align=left><span>MySQL 5.0</span><span>支持存储过程语句。</span></p>
<p align=left>&nbsp;</p>
<table cellPadding=0 border=0>
    <tbody>
        <tr>
            <td>
            <p align=left><strong><span>一<span>.</span>创建存储过程</span></strong></p>
            <p align=left><span>1.</span><span>基本语法：</span></p>
            <p align=left><span>create&nbsp;procedure&nbsp;sp_name()<br>begin<br>.........<br>end</span></p>
            <p align=left><span>2.</span><span>参数传递</span></p>
            <p align=left><strong><span>二<span>.</span>调用存储过程</span></strong></p>
            <p align=left><span>1.</span><span>基本语法：<span>call&nbsp;sp_name()<br></span>注意：存储过程名称后面必须加括号，哪怕该存储过程没有参数传递</span></p>
            <p align=left><strong><span>三<span>.</span>删除存储过程</span></strong></p>
            <p align=left><span>1.</span><span>基本语法：<span><br>drop&nbsp;procedure&nbsp;sp_name//<br>2.</span>注意事项<span><br>(1)</span>不能在一个存储过程中删除另一个存储过程，只能调用另一个存储过程</span></p>
            <p align=left><strong><span>四<span>.</span>区块，条件，循环</span></strong></p>
            <p align=left><span>1.</span><span>区块定义，常用<span><br>begin<br>......<br>end;<br></span>也可以给区块起别名，如：<span><br>lable:begin<br>...........<br>end&nbsp;lable;<br></span>可以用<span>leave&nbsp;lable;</span>跳出区块，执行区块以后的代码<span><br>2.</span>条件语句</span></p>
            <p align=left><span><span>if</span>&nbsp;</span><span>条件&nbsp;</span><span>then</span><span><br>statement<br></span><span>else</span><span><br>statement<br></span><span>end</span>&nbsp;<span>if</span><span>;</span></p>
            <p align=left><span><br>3.</span><span>循环语句<span><br>(1).while</span>循环</span></p>
            <p align=left><span><span>[label:]</span>&nbsp;<span>WHILE</span><span>&nbsp;expression&nbsp;DO<br><br>statements<br><br></span><span>END</span>&nbsp;<span>WHILE</span>&nbsp;<span>[label]</span><span>&nbsp;;<br></span></span></p>
            <p align=left>&nbsp;</p>
            <p align=left><span>(2).loop</span><span>循环</span></p>
            <p align=left><span><span>[label:]</span><span>&nbsp;<st1:place w:st="on">LOOP</st1:place><br><br>statements<br><br></span><span>END</span><span>&nbsp;LOOP&nbsp;</span><span>[label]</span><span>;</span></span></p>
            <p align=left>&nbsp;</p>
            <p align=left><span>(3).repeat&nbsp;until</span><span>循环</span></p>
            <p align=left><span><span>[label:]</span><span>&nbsp;REPEAT<br><br>statements<br><br>UNTIL&nbsp;expression<br><br></span><span>END</span><span>&nbsp;REPEAT&nbsp;</span><span>[label]</span><span>&nbsp;;</span></span></p>
            <p align=left>&nbsp;</p>
            <p align=left><strong><span>五<span>.</span>其他常用命令</span></strong></p>
            <p align=left><span>1.show&nbsp;procedure&nbsp;status<br></span><span>显示数据库中所有存储的存储过程基本信息，包括所属数据库，存储过程名称，创建时间等<span><br>2.show&nbsp;create&nbsp;procedure&nbsp;sp_name</span></span></p>
            </td>
        </tr>
    </tbody>
</table>
<p align=left><strong><u><span>存储过程创建语法<span>:</span></span></u></strong></p>
<div align=center>
<table cellPadding=0 width="80%" border=1>
    <tbody>
        <tr>
            <td>
            <p align=left><span>CREATE PROCEDURE procedure_name ([parameter[,...]) </span></p>
            <p align=left><span>[LANGUAGE SQL] </span></p>
            <p align=left><span>[ [NOT] DETERMINISTIC ] </span></p>
            <p align=left><span>[{CONTAINS SQL|MODIFIES SQL DATA|READS SQL DATA|NO SQL}] </span></p>
            <p align=left><span>[SQL SECURITY {DEFINER|INVOKER} ] </span></p>
            <p align=left><span>[COMMENT comment_string] </span></p>
            <p align=left><span>procedure_statements </span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p align=left><span><br>&nbsp;<br></span><span>可用<span>SHOW PROCEDURE STATUS </span>或<span> SHOW CREATE PROCEDURE </span>来查看存储过程信息<span><br></span>另，系统表<span>INFORMATION_SCHEMA.ROUTINES</span>也包含了存储过程的一些信息<span><br></span>同样地<span>,</span>函数也可以使用同样方式查看<span>(SHOW FUNCTION STATUS) </span></span></p>
<p align=left><span><br></span><strong><u><span>函数的创建</span></u></strong><span><br>&nbsp;</span></p>
<div align=center>
<table cellPadding=0 width="80%" border=1>
    <tbody>
        <tr>
            <td>
            <p align=left><span>CREATE FUNCTION function_name (parameter[,...]) </span></p>
            <p align=left><span>RETURNS datatype </span></p>
            <p align=left><span>[LANGUAGE SQL] </span></p>
            <p align=left><span>[ [NOT] DETERMINISTIC ]</span></p>
            <p align=left><span>[ {CONTAINS SQL | NO SQL | MODIFIES SQL DATA | READS SQL DATA} ] </span></p>
            <p align=left><span>[ SQL SECURITY {DEFINER|INVOKER} ] </span></p>
            <p align=left><span>[ COMMENT comment_string ] </span></p>
            <p align=left><span>语句体<span> </span></span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p align=left><span><br></span><span>函数与存储过程基本一样，其区别主要有<span>:<br>1</span>、&nbsp;要使用<span>RETURNS</span>指定返回类型<span><br>2</span>、&nbsp;函数必须返回值<span>,</span>且在语句体中使用<span>RETURN</span>返回<span>(</span>注意<span>:</span>指定返回类型用<span>RETURNS,</span>返回值用<span>RETURN)<br>3</span>、&nbsp;参数不区分<span>IN</span>，<span>OUT</span>，全部为<span>IN</span>类形</span></p>
<p align=left><span><br></span><span>例<span>:<br>CREATE FUNCTION cust_status(in_status CHAR(1))<br>&nbsp;&nbsp;&nbsp; RETURNS VARCHAR(20)<br>BEGIN<br>&nbsp;&nbsp;&nbsp; DECLARE long_status VARCHAR(20);<br>&nbsp;&nbsp;&nbsp; IF in_status = 'O' THEN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SET long_status='Overdue';<br>&nbsp;&nbsp;&nbsp; ELSEIF in_status = 'U' THEN&nbsp;&nbsp;&nbsp; SET long_status='Up to date';<br>&nbsp;&nbsp;&nbsp; ELSEIF in_status = 'N' THEN&nbsp;&nbsp;&nbsp; SET long_status='New';<br>&nbsp;&nbsp;&nbsp; END IF;<br>&nbsp;&nbsp;&nbsp; RETURN(long_status);<br>END;<br>&nbsp;<br></span>调用<span>:<br>SELECT cust_status('O');<br>&nbsp;<br></span><strong><u>触发器</u></strong><span><br>&nbsp;</span></span></p>
<div align=center>
<table cellPadding=0 width="80%" border=1>
    <tbody>
        <tr>
            <td>
            <p align=left><span>CREATE [DEFINER={user|CURRENT_USER}] TRIGGER trigger_name </span></p>
            <p align=left><span>{BEFORE|AFTER} {UPDATE|INSERT|DELETE} </span></p>
            <p align=left><span>ON table_name </span></p>
            <p align=left><span>FOR EACH ROW </span></p>
            <p align=left><span>trigger_statements </span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p align=left><span><br>&nbsp;<br></span><span>意义<span>:</span>当对表<span>table_name</span>执行<span>update</span>，<span>insert,delete</span>操作之前<span>(before)</span>或之后<span>(after)</span>时触发语句<span>trigger_statements</span>操作</span></p>
<p align=left><span>例<span>:<br>mysql&gt; CREATE TRIGGER account_balance_au<br>&nbsp;AFTER UPDATE ON account_balance FOR EACH ROW<br>BEGIN<br>&nbsp; DECLARE dummy INT;<br>&nbsp; IF NEW.balance&lt;0 THEN<br>&nbsp;&nbsp;&nbsp;&nbsp; SET NEW.balance=NULL;<br>&nbsp; END IF;<br>END<br>&nbsp;<br></span>上述触发器表示<span>:</span>当更新表<span>account_balance</span>之后，如果更新的值<span>balance</span>小于<span>0,</span>则将它改为<span>NULL,<br></span>注<span>:</span>如果为<span>OLD.balance</span>则表示更新前的原值</span></p>
<p>&nbsp;</p>
<img src ="http://www.cnitblog.com/szdlinxie/aggbug/50062.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/szdlinxie/" target="_blank">szdlinxie</a> 2008-10-10 17:46 <a href="http://www.cnitblog.com/szdlinxie/archive/2008/10/10/50062.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Linux下常用压缩格式的压缩与解压方法</title><link>http://www.cnitblog.com/szdlinxie/archive/2008/09/12/49059.html</link><dc:creator>szdlinxie</dc:creator><author>szdlinxie</author><pubDate>Fri, 12 Sep 2008 15:40:00 GMT</pubDate><guid>http://www.cnitblog.com/szdlinxie/archive/2008/09/12/49059.html</guid><wfw:comment>http://www.cnitblog.com/szdlinxie/comments/49059.html</wfw:comment><comments>http://www.cnitblog.com/szdlinxie/archive/2008/09/12/49059.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/szdlinxie/comments/commentRss/49059.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/szdlinxie/services/trackbacks/49059.html</trackback:ping><description><![CDATA[<div id=article_detail>
<h1 class=bigTitle>Linux下常用压缩格式的压缩与解压方法</h1>
</div>
<div id=content>
<p>.tar<br>解包： tar xvf FileName.tar<br>打包：tar cvf FileName.tar DirName<br>（注：tar是打包，不是压缩！）<br>---------------------------------------------<br>.gz<br>解压1：gunzip FileName.gz<br>解压2：gzip -d FileName.gz<br>压缩：gzip FileName<br>.tar.gz<br>解压：tar zxvf FileName.tar.gz<br>压缩：tar zcvf FileName.tar.gz DirName<br>---------------------------------------------<br>.bz2<br>解压1：bzip2 -d FileName.bz2<br>解压2：bunzip2 FileName.bz2<br>压缩： bzip2 -z FileName<br>.tar.bz2<br>解压：tar jxvf FileName.tar.bz2<br>压缩：tar jcvf FileName.tar.bz2 DirName<br>---------------------------------------------<br>.bz<br>解压1：bzip2 -d FileName.bz<br>解压2：bunzip2 FileName.bz<br>压缩：未知<br>.tar.bz<br>解压：tar jxvf FileName.tar.bz<br>压缩：未知<br>---------------------------------------------<br>.Z<br>解压：uncompress FileName.Z<br>压缩：compress FileName<br>.tar.Z<br>解压：tar Zxvf FileName.tar.Z<br>压缩：tar Zcvf FileName.tar.Z DirName<br>---------------------------------------------<br>.tgz<br>解压：tar zxvf FileName.tgz<br>压缩：未知<br>.tar.tgz<br>解压：tar zxvf FileName.tar.tgz<br>压缩：tar zcvf FileName.tar.tgz FileName<br>---------------------------------------------<br>.zip<br>解压：unzip FileName.zip<br>压缩：zip FileName.zip DirName<br>---------------------------------------------<br>.rar<br>解压：rar a FileName.rar<br>压缩：r ar e FileName.rar</p>
<p><br>---------------------------------------------<br>.lha<br>解压：lha -e FileName.lha<br>压缩：lha -a FileName.lha FileName</p>
<p>.rpm<br>解包：rpm2cpio FileName.rpm | cpio -div<br>---------------------------------------------<br>.tar .tgz .tar.gz .tar.Z .tar.bz .tar.bz2 .zip .cpio .rpm .deb .slp .arj .rar .ace .lha .lzh&nbsp;<br>.lzx .lzs .arc .sda .sfx .lnx .zoo .cab .kar .cpt .pit .sit .sea<br>解压：sEx x FileName.*<br>压缩：sEx a FileName.* FileName</p>
</div>
<img src ="http://www.cnitblog.com/szdlinxie/aggbug/49059.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/szdlinxie/" target="_blank">szdlinxie</a> 2008-09-12 23:40 <a href="http://www.cnitblog.com/szdlinxie/archive/2008/09/12/49059.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Cacti实现MSN报警</title><link>http://www.cnitblog.com/szdlinxie/archive/2008/09/05/48771.html</link><dc:creator>szdlinxie</dc:creator><author>szdlinxie</author><pubDate>Fri, 05 Sep 2008 15:22:00 GMT</pubDate><guid>http://www.cnitblog.com/szdlinxie/archive/2008/09/05/48771.html</guid><wfw:comment>http://www.cnitblog.com/szdlinxie/comments/48771.html</wfw:comment><comments>http://www.cnitblog.com/szdlinxie/archive/2008/09/05/48771.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cnitblog.com/szdlinxie/comments/commentRss/48771.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/szdlinxie/services/trackbacks/48771.html</trackback:ping><description><![CDATA[<h2><a title="Permanent Link: Cacti实现MSN报警" href="http://www.hiadmin.com/cacti%e5%ae%9e%e7%8e%b0msn%e6%8a%a5%e8%ad%a6/" rel=bookmark><u><font color=#810081>Cacti实现MSN报警</font></u></a></h2>
<div class=allinfos>一、 软件环境：cacti（需Threshold插件），MSN机器人（SendMsg）<br>二、 安装过程：<br>Cacti的Threshold插件参见：<a href="http://www.hiadmin.com/cacti%e9%85%8d%e7%bd%aee-mail%e6%8a%a5%e8%ad%a6/"><u><font color=#810081>Cacti配置e-mail报警</font></u></a><br>MSN机器人(SendMsg)参见：<a href="http://www.hiadmin.com/%e7%b3%bb%e7%bb%9f%e7%9b%91%e6%8e%a7%ef%bc%9amsn%e5%9c%a8%e7%ba%bf%e6%9c%ba%e5%99%a8%e4%ba%ba%e5%ae%9e%e6%97%b6%e6%8a%a5%e8%ad%a6/"><u><font color=#0000ff>系统监控：msn在线机器人实时报警</font></u></a><br>三、 配置过程：<br>1.按照<a href="http://www.hiadmin.com/cacti%e9%85%8d%e7%bd%aee-mail%e6%8a%a5%e8%ad%a6/"><u><font color=#810081>Cacti配置e-mail报警</font></u></a>配置并启用thold<br>2.编辑cacti/plugins/thold/thold-functions.php<br>在thold&#8211;functions.php查找thold_mail($global_alert_address, &#8221;, $subject, $msg, $file_array);行在此行下面加入： </div>
<div class=hl-surround>
<div class=hl-main>exec("echo $subject &gt;&gt;/var/www/html/cacti/plugins/thold/alter.log");<br>exec("sh /var/www/html/cacti/plugins/thold/sendmessage.sh");</div>
</div>
<p>查找 thold_mail($item["notify_extra"], &#8221;, $subject,<br>$msg, $file_array);行在此行下面加入：</p>
<div class=hl-surround>
<div class=hl-main>exec("echo $subject &gt;&gt;/var/www/html/cacti/plugins/thold/alter.log");<br>exec("sh /var/www/html/cacti/plugins/thold/sendmessage.sh");</div>
</div>
<p>备注：本人的thold安装在/var/www/html/cacti/plugins/thold/目录中，如果注释掉thold_mail，只通过MSN发送报警。不注释掉thold_mail，会通过email和MSN同时发送报警</p>
<p>thold-functions.php生成的alter.log范例如下：</p>
<div class=hl-surround>
<div class=hl-main>192.168.1.207 - Used Space - G: Label: [hdd_percent] is still above threshold of 85 with 99</div>
</div>
<p>编写脚本sendmessage.sh自动调用SendMsg发送报警</p>
<div class=hl-surround>
<div class=hl-main>#!/bin/sh<br>echo `echo -n "date:"&amp;&amp;date +%Y-%m-%d-%H:%M` &gt;&gt; /var/www/html/sendMsg/msn.txt.1<br>#得到当前的日期+时间<br>cat /var/www/html/cacti/plugins/thold/alter.log &gt;&gt;/var/www/html/sendMsg/msn.txt.1<br>#读取alter.log的报警信息<br>now=`date +%Y-%m-%d-%H:%M`<br>SA=(disk)<br>msnaddr=(lvming104@hotmail.com) #报警接收人msn<br>sendMsg()<br>{<br>num=0<br>while [ $num -lt 1 ];<br>do<br>wget --post-data "sender=test@live.cn&amp;password=12346&amp;recipient=${1}&amp;message=${2}" http://127.0.0.1/sendMsg/index.php -O /var/www/html/sendMsg/index.php.1 &gt;/dev/null 2&gt;&amp;1<br>#sender：发送人msn，password：密码。/var/www/html/sendMsg为sendMsn安装目录<br>if [ -f /var/www/html/sendMsg/index.php.1 ]; then<br>if cat /var/www/html/sendMsg/index.php.1 |grep -i successfully &gt;/dev/null 2&gt;&amp;1;then<br>num=1 #判断信息发送成功<br>elif cat /var/www/html/sendMsg/index.php.1 |grep -i "The user appears to be offline" &gt;/dev/null 2&gt;&amp;1;then<br>num=1 #判断msn接受人为是否在线状态<br>echo "The user is offline."<br>exit 0<br>elif cat /var/www/html/sendMsg/index.php.1 |grep -i "Something went wrong trying to connect to the server" &gt;/dev/null 2&gt;&amp;1;then<br>num=1 #判断msn 服务器存在连接问题<br>echo "MSN server is wrong."<br>exit 0<br>else<br>num=0 #除了以上三种情况退出循环外，其他情况重试。<br>fi<br>rm -f /var/www/html/sendMsg/index.php.1<br>else<br>num=0<br>fi<br>done<br>}<br>&nbsp;<br>mv /var/www/html/sendMsg/msn.txt /var/www/html/sendMsg/bak/msn$now.txt -f 1&gt;/dev/null 2&gt;&amp;1<br>mv /var/www/html/sendMsg/msn.txt.1 /var/www/html/sendMsg/msn.txt -f 1&gt;/dev/null 2&gt;&amp;1<br>rm /var/www/html/cacti/plugins/thold/alter.log -f 1&gt;/dev/null 2&gt;&amp;1<br><br>for i in 0 <br>do<br>if cat /var/www/html/sendMsg/msn.txt ; then<br>messages=`cat /var/www/html/sendMsg/msn.txt ` #读取要发送的信息<br>sendMsg "${msnaddr[$i]}" "$messages" #发送报警信息<br>else<br>continue<br>fi<br>done</div>
</div>
<p>ok，配置完成了，现在就可以通过MSN接收报警信息了：如下所示<br><a href="http://www.hiadmin.com/wp-content/uploads/2008/08/14.jpg"><img class="alignnone size-medium wp-image-753" title=14 height=267 alt="" src="http://www.hiadmin.com/wp-content/uploads/2008/08/14-300x267.jpg" width=300></a></p>
<p>下次更新Cacti实现短信报警，敬请期待</p>
<img src ="http://www.cnitblog.com/szdlinxie/aggbug/48771.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/szdlinxie/" target="_blank">szdlinxie</a> 2008-09-05 23:22 <a href="http://www.cnitblog.com/szdlinxie/archive/2008/09/05/48771.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Cacti配置e-mail报警</title><link>http://www.cnitblog.com/szdlinxie/archive/2008/09/05/48770.html</link><dc:creator>szdlinxie</dc:creator><author>szdlinxie</author><pubDate>Fri, 05 Sep 2008 15:20:00 GMT</pubDate><guid>http://www.cnitblog.com/szdlinxie/archive/2008/09/05/48770.html</guid><wfw:comment>http://www.cnitblog.com/szdlinxie/comments/48770.html</wfw:comment><comments>http://www.cnitblog.com/szdlinxie/archive/2008/09/05/48770.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/szdlinxie/comments/commentRss/48770.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/szdlinxie/services/trackbacks/48770.html</trackback:ping><description><![CDATA[<h2><a title="Permanent Link: Cacti配置e-mail报警" href="http://www.hiadmin.com/cacti%e9%85%8d%e7%bd%aee-mail%e6%8a%a5%e8%ad%a6/" rel=bookmark><u><font color=#810081>Cacti配置e-mail报警</font></u></a></h2>
<div class=allinfos>一、 软件环境：cacti（需Threshold插件）<br>二、 安装过程：<br>Cacti的安装各位baidu一下，这里就不详细介绍了。<br>安装Threshold插件<br>V0.3.9下载地址：<a onclick="pageTracker._trackPageview('/outgoing/mirror.cactiusers.org/downloads/plugins/thold-0.3.9.tar.gzv?referer=http://www.hiadmin.com/cacti%e5%ae%9e%e7%8e%b0msn%e6%8a%a5%e8%ad%a6/');" href="http://mirror.cactiusers.org/downloads/plugins/thold-0.3.9.tar.gzv"><u><font color=#0000ff>http://mirror.cactiusers.org/downloads/plugins/thold-0.3.9.tar.gzv</font></u></a><br>安装Threshold插件，只需将解压出来的Thold目录拷贝到cacti/plugins/目录下，并修改cacti配置文件（cacti目录下的include/config.php）。在配置中查找$plugins = array();行，在此行下面加入： </div>
<div class=hl-surround>
<div class=hl-main>$plugins[] = 'thold';</div>
</div>
<p>刷新cacti首页，你将看到多出来一个Threshld选项卡。如下所示<br><a href="http://www.hiadmin.com/wp-content/uploads/2008/08/1.jpg"><img class="alignnone size-medium wp-image-713" title=1 height=18 alt="" src="http://www.hiadmin.com/wp-content/uploads/2008/08/1-300x18.jpg" width=300></a><br>三、 配置过程：<br>1．设置Threshold插件：选中console选项卡，在左侧菜单中点击Settings，然后点击Alerting/Thold选项卡<br><a href="http://www.hiadmin.com/wp-content/uploads/2008/08/2.jpg"><img class="alignnone size-medium wp-image-714" title=2 height=170 alt="" src="http://www.hiadmin.com/wp-content/uploads/2008/08/2-300x170.jpg" width=300></a><br><a href="http://www.hiadmin.com/wp-content/uploads/2008/08/3.jpg"><img class="alignnone size-medium wp-image-715" title=3 height=156 alt="" src="http://www.hiadmin.com/wp-content/uploads/2008/08/3-300x156.jpg" width=300></a><br>2．设置发送警报通知：在Default Alerting Options中选择Send notifications<br>3．设置出现down机的情况时（即Monitor出现如图所示 <a href="http://www.hiadmin.com/wp-content/uploads/2008/08/4.jpg"><img class="alignnone size-medium wp-image-717" title=4 height=63 alt="" src="http://www.hiadmin.com/wp-content/uploads/2008/08/4.jpg" width=43></a>）发送警报通知：选择Dead Hosts notifications<br>报警邮件范例如下：</p>
<div class=hl-surround>
<div class=hl-main>Host Error : 192.168.1.220 (192.168.1.220) is DOWN<br>Message : Host did not respond to SNMP&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;（down机报警）</div>
</div>
<div class=hl-surround>
<div class=hl-main>Host Notice : 192.168.1.207 (192.168.1.207) returned from DOWN state&nbsp; &nbsp;（恢复）</div>
</div>
<p>4．设置警报发送纯文本的电子邮件没有图（默认是HTML电子邮件与图表嵌入在电子邮件）：选择Send alerts as text<br>5．设置周末不执行报警检查：选择Weekend exemptions<br>6．设置报警的门槛：Default Trigger Count<br>7．设置Emailing Options</p>
<div class=hl-surround>
<div class=hl-main>Mail Services：SMTP。（可以选择PHP mail，sendmail，SMTP三种方式）<br>From Email Address：按实际设置<br>From Name：按需要设置（该处显示的name就是email的发件人姓名）</div>
</div>
<p>8．设置Sendmail Options（Mail Services设置为sendmail需设置此项）</p>
<div class=hl-surround>
<div class=hl-main>Sendmail Path：/usr/sbin/sendmail（路径是服务器上Sendmail的，仅用于邮件服务选定为Sendmail）</div>
</div>
<p>9．设置SMTP Options（Mail Services设置SMTP需设置此项）</p>
<div class=hl-surround>
<div class=hl-main>SMTP Hostname：SMTP服务器如：mail.test.com<br>SMTP Port:25<br>SMTP Username: 通过SMTP发送邮件用来验证的用户名，如果你不要求身份验证留空<br>SMTP Password：通过SMTP发送邮件用来验证的密码，如果你不要求身份验证留空</div>
</div>
<p>测试：点击Send a Test Email，测试成功如下所示：<br><a href="http://www.hiadmin.com/wp-content/uploads/2008/08/13.jpg"><img class="alignnone size-medium wp-image-712" title=13 height=78 alt="" src="http://www.hiadmin.com/wp-content/uploads/2008/08/13-300x78.jpg" width=300></a><br>收到的测试邮件范例：</p>
<div class=hl-surround>
<div class=hl-main>This is a test message generated from Cacti. This message was sent to test the configuration of your Mail Settings.<br>Your email settings are currently set as follows<br>Method: SMTP<br>Host: mail.ips.com.cn<br>Port: 25<br>Authenication: true<br>Username: john.lv<br>Password: (Not Shown for Security Reasons)</div>
</div>
<p>配置完成后别忘记save。<br>下面我以磁盘空间报警为例，来设置具体的报警信息（CPU，DISK，服务，网络等等）<br>在console选项卡下左侧菜单中点击Threshold Templates 。<br><a href="http://www.hiadmin.com/wp-content/uploads/2008/08/4.bmp"><img class="alignnone size-medium wp-image-716" title=4 alt="" src="http://www.hiadmin.com/wp-content/uploads/2008/08/4.bmp"></a><br>在如下图所示中点击Add按钮来添加一个Threshold模板<br><a href="http://www.hiadmin.com/wp-content/uploads/2008/08/5.jpg"><img class="alignnone size-medium wp-image-718" title=5 height=50 alt="" src="http://www.hiadmin.com/wp-content/uploads/2008/08/5-300x50.jpg" width=300></a><br>添加磁盘监控的模板，无论是linux还是windows都是使用的Host MIB<br><a href="http://www.hiadmin.com/wp-content/uploads/2008/08/6.jpg"><img class="alignnone size-medium wp-image-719" title=6 height=91 alt="" src="http://www.hiadmin.com/wp-content/uploads/2008/08/6-300x91.jpg" width=300></a><br>设置按照百分比来监控的，在Data Field选择hdd_percent，可以选择hdd_total,hdd_used,hdd_percent三种<br><a href="http://www.hiadmin.com/wp-content/uploads/2008/08/7.jpg"><img class="alignnone size-medium wp-image-720" title=7 height=91 alt="" src="http://www.hiadmin.com/wp-content/uploads/2008/08/7-300x91.jpg" width=300></a><br>设置以下信息（参照下图：）<br>选择Enabled 激活检查和报警提醒<br>High Threshold文本框中填入0.085，意思是当硬盘使用率超过85％时，发送邮件报警。<br>Threshold CDEF下拉框选择Divide by 1024，<br>Alert E-Mail填入报警的接收邮箱<br>完成Threshold模板的添加。<br><a href="http://www.hiadmin.com/wp-content/uploads/2008/08/8.jpg"><img class="alignnone size-medium wp-image-721" title=8 height=197 alt="" src="http://www.hiadmin.com/wp-content/uploads/2008/08/8-300x197.jpg" width=300></a><br>应用刚才创建的Threshold模板<br>在console选项卡下点击Management -&gt;Devices，选择要应用此模板的Host，点击最上面的Create Graphs for this Host链接，然后点击Auto-create thresholds链接来应用刚创建的Threshold模板。<br><a href="http://www.hiadmin.com/wp-content/uploads/2008/08/9.jpg"><img class="alignnone size-medium wp-image-722" title=9 height=37 alt="" src="http://www.hiadmin.com/wp-content/uploads/2008/08/9-300x37.jpg" width=300></a><br>设置完成后在console选项卡下左侧菜单中点击Thresholds<br><a href="http://www.hiadmin.com/wp-content/uploads/2008/08/10.bmp"><img class="alignnone size-medium wp-image-723" title=10 alt="" src="http://www.hiadmin.com/wp-content/uploads/2008/08/10.bmp"></a><br>在此可以管理已创建的警报，如下：<br><a href="http://www.hiadmin.com/wp-content/uploads/2008/08/11.jpg"><img class="alignnone size-medium wp-image-724" title=11 height=144 alt="" src="http://www.hiadmin.com/wp-content/uploads/2008/08/11-300x144.jpg" width=300></a><br>点击threshld选项卡可以查看警报的触发情况，如下：<br><a href="http://www.hiadmin.com/wp-content/uploads/2008/08/12.jpg"><img class="alignnone size-medium wp-image-725" title=12 height=83 alt="" src="http://www.hiadmin.com/wp-content/uploads/2008/08/12-300x83.jpg" width=300></a><br>磁盘报警邮件范例：</p>
<div class=hl-surround>
<div class=hl-main>Host: 192.168.1.207 (192.168.1.207)<br>URL: http://192.168.1.211/cacti//graph.php?local_graph_id=&amp;rra_id=1<br>Message: 192.168.1.207 - Used Space - D: Label:tool [hdd_percent] went<br>above threshold of 0.085 with 0.0896</div>
</div>
<p>Ok,磁盘空间的邮件报警就正式配置完成了。</p>
<img src ="http://www.cnitblog.com/szdlinxie/aggbug/48770.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/szdlinxie/" target="_blank">szdlinxie</a> 2008-09-05 23:20 <a href="http://www.cnitblog.com/szdlinxie/archive/2008/09/05/48770.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>RedHat Linux 下安装配置CACTI的技巧</title><link>http://www.cnitblog.com/szdlinxie/archive/2008/09/03/48684.html</link><dc:creator>szdlinxie</dc:creator><author>szdlinxie</author><pubDate>Wed, 03 Sep 2008 14:45:00 GMT</pubDate><guid>http://www.cnitblog.com/szdlinxie/archive/2008/09/03/48684.html</guid><wfw:comment>http://www.cnitblog.com/szdlinxie/comments/48684.html</wfw:comment><comments>http://www.cnitblog.com/szdlinxie/archive/2008/09/03/48684.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/szdlinxie/comments/commentRss/48684.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/szdlinxie/services/trackbacks/48684.html</trackback:ping><description><![CDATA[<p><strong>安装环境及需求:</strong>
<p>1.系统:RedHat AS4(update2)
<p>2.软件包需求:cacti-0.8.6j,mysql-5.0.20,php-5.2.0,apache2.0.58(以上均为源码包).
<p><strong>安装配置过程:</strong>
<p>1. 安装apache2.0.58
<p>解压软件包,进入安装目录,我的编译过程如下:
<p># ./configure --prefix=/usr/local/apache2 --enable-modules=so
<p># make;make install
<p>编译选项比较简单,--prefix=你需要把apache安装的位置,--enable-modules=so意思是可以动态加载apache所需
<p>要的.so 的模块
<p>安装完成后,编辑apache的配置文件,使之能正常使用:
<p># vi /usr/local/apache2/conf/httpd.conf
<p>找到下面这行:
<p>#ServerName www.example.com:80
<p>改为:
<p>ServerName yourIP:80
<p>启动apache:
<p>#/usr/local/apache2/bin/apachectl start
<p>在浏览器里输入你的IP或者localhost测试一下,是否能看到apache的测试页,成功的话,说明安装成功
<p>2.安装mysql-5.0.20
<p>解压软件包,进入安装目录,我的编译过程如下:
<p># ./configure --prefix=/usr/local/mysql
<p># make;make install
<p># cp support-files/my-medium.cnf /etc/my.cnf (这一步是将配置文件拷贝到/etc下面)
<p>编译选项当中指定安装路径就可以了
<p>配置mysql过程:
<p>#groupadd mysql
<p>#useradd -g mysql mysql
<p>#cd /usr/local/mysql
<p>#./bin/mysql_install_db --user=mysql
<p>#chown -R root .
<p>#chown -R mysql var
<p>#chogrp -R mysql .
<p>启动mysql
<p>#./bin/mysqld_safe --user=mysql &amp;
<p>如果看到下面的信息,就说明启动成功了
<p># Starting mysqld daemon with databases from /usr/local/mysql/var
<p>可以测试一下,看看能不能登陆mysql数据库
<p># /usr/local/mysql/bin/mysqladmin -uroot password '你的密码' (给初始登陆mysql的用户root设置密码,当
<p>然不设置也能登陆,推荐设置密码)
<p># /usr/local/mysql/bin/mysql -uroot -p你的密码 (注意: -p后面不要带空格)
<p>如果出现下面的欢迎字样,说明连接成功:
<p>Welcome to the MySQL monitor. Commands end with ; or g.
<p>Your MySQL connection id is 9 to server version: 5.0.20a-log
<p>mysql&gt;
<p>3.安装php-5.2.0
<p>解压软件包,进入安装目录,我的编译过程如下:
<p># ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-
<p>mysql=/usr/local/mysql --with-config-file-path=/usr/local/php/etc
<p>#make;make install
<p>编译选项中--with-apxs2=/usr/local/apache2/bin/apxs 是说将PHP模块编译进apache,--with-
<p>mysql=/usr/local/mysql 是说指定mysql的路径(其实就是告诉PHP我们的mysql的一些头文件信息,如果你的
<p>mysql和PHP不是同一台机器的话,指定mysql的头信息是编译必要的),--with-config-file-
<p>path=/usr/local/php/etc 是说将PHP的主配置文件放在什么地方,这是个人习惯
<p>#cp php.ini-dist /usr/local/php/etc/php.ini
<p>#vi /usr/local/php/etc/php.ini
<p>找到如下内容:
<p>register_globals = Off
<p>改为:
<p>register_globals = On
<p>为了使PHP能够配合apache使用,还需要修改apache的配置文件:
<p>#vi /usr/local/apache2/conf/httpd.conf
<p>找到下面字段:
<p>DirectoryIndex
<p>在iindex.html前面添加index.php
<p>并在配置文件最后加入如下字段:
<p>AddHandler php5-script .php
<p>AddType text/html .php
<p>测试PHP是否正常运行:
<p>#vi /usr/local/apache2/htdocs/index.php
<p>写入下面一行:
<p>＜?php phpinfo() ?＞
<p>保存退出后重新启动apache
<p>#/usr/local/apache2/bin/apachectl restart
<p>这里需要注意,如果系统的selinux没有关闭的话,我们的php的模块是不能被apache正确找到的,所以在重起apache
<p>之前,请将selinux关闭,具体做法是:
<p>#vi /etc/selinux/config
<p>找到如下字段:
<p>SELINUX=enforcing
<p>改为:
<p>SELINUX=disabled
<p>保存退出后需要重新启动电脑
<p>在浏览器里输入IP，如果能够看到phpinfo的测试页，那么PHP已经正常工作了
<p>4.安装cacti-0.8.6j
<p>安装前的准备：由于cacti需要net-snmp和rrdtool两个工具来配合使用，所以需要安装这两个工具，由于默认完
<p>全安装RedHat AS4的情况下这两的工具是都安装好的，所以我之前没有提到，如果没有安装这两个工具，那么建
<p>议去http://rpmfind.net去找相关的rpm包来安装，这个网站使用起来很方便，只要输入工具的名字，就能把rpm
<p>包匹配的系统版本的所有rpm包列出来，很方便，rpm包的安装，我这里就不赘述了
<p>以下的配置是默认安装好了上述两个工具的配置
<p>解压cacti的软件包，进行如下操作：
<p>#mv cacti-0.8.6j /usr/local/apache2/htdocs/cacti
<p>#cd /usr/local/apache2/htdocs/cacti
<p>#/usr/local/mysql/bin/mysql -uroot -p你的密码
<p>mysql&gt; grant all privileges on *.* to '你的用户名[email=]'@'localhost'[/email] identified by '为这用户添加的密码'
<p>with grant option;
<p>mysql&gt; create database cacti;
<p>mysql&gt; exit
<p>#/usr/local/mysql/bin/mysql -u用户名 -p你的密码 cacti &lt; cacti.sql
<p>#vi include/config.php
<p>修改如下段落：
<p>$database_type = "mysql";
<p>$database_default = "cacti";
<p>$database_hostname = "localhost";
<p>$database_username = "cactiuser";
<p>$database_password = "cactiuser";
<p>$database_port = "3306";
<p>改为：
<p>$database_type = "mysql";
<p>$database_default = "cacti";
<p>$database_hostname = "localhost";
<p>$database_username = "用户名";
<p>$database_password = "你的密码";
<p>$database_port = "3306";
<p><strong>修改snmp的配置文件：</strong>
<p>#vi /etc/snmp/snmpd.conf
<p><strong>修改下面几部分内容：</strong>
<p>1.)com2sec notConfigUser default public
<p>改为：com2sec notConfigUser localhost public
<p>2.)access notConfigGroup "" any noauth exact systemview none none
<p>改为：access notConfigGroup "" any noauth exact all none none
<p>3.)#view all included .1 80
<p>去掉注释
<p>保存退
<p>启动snmp
<p>#/etc/init.d/snmpd start
<p>修改计划任务，使CACTI每5分钟获得一次数据：
<p>#crontab -e -u 用户名
<p><strong>添加如下内容：</strong>
<p>*/5 * * * * /usr/local/php/bin/php /usr/local/apache2/htdocs/cacti/poller.php &gt; /dev/null 2&gt;&amp;1
<p>保存退出
<p>#chown -R rra/ log/
<p>这样cacti就基本配置完成了
<p>在浏览器里输入IP/cacti初始进入的时候需要告诉cacti你的PHP的可执行文件的路径，其他默认就可以，默认的
<p>用户名和密码是admin和admin。进去后要马上修改密码，保存后就进入cacti的世界了。 </p>
<img src ="http://www.cnitblog.com/szdlinxie/aggbug/48684.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/szdlinxie/" target="_blank">szdlinxie</a> 2008-09-03 22:45 <a href="http://www.cnitblog.com/szdlinxie/archive/2008/09/03/48684.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Oracle数据库导入导出方法</title><link>http://www.cnitblog.com/szdlinxie/archive/2008/09/02/48612.html</link><dc:creator>szdlinxie</dc:creator><author>szdlinxie</author><pubDate>Tue, 02 Sep 2008 02:23:00 GMT</pubDate><guid>http://www.cnitblog.com/szdlinxie/archive/2008/09/02/48612.html</guid><wfw:comment>http://www.cnitblog.com/szdlinxie/comments/48612.html</wfw:comment><comments>http://www.cnitblog.com/szdlinxie/archive/2008/09/02/48612.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/szdlinxie/comments/commentRss/48612.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/szdlinxie/services/trackbacks/48612.html</trackback:ping><description><![CDATA[<strong>.使用命令行：</strong>
<p style="TEXT-INDENT: 2em">
<p style="TEXT-INDENT: 2em"><strong>数据导出：</strong>
<p style="TEXT-INDENT: 2em"><strong>1.将数据库TEST完全导出,用户名system密码manager导出到D:\daochu.dmp中</strong>
<p style="TEXT-INDENT: 2em">exp system/manager@TEST file=d:\daochu.dmp full=y
<p style="TEXT-INDENT: 2em"><strong>2.将数据库中system用户与sys用户的表导出</strong>
<p style="TEXT-INDENT: 2em">exp system/manager@TEST file=d:\daochu.dmp owner=(system,sys)
<p style="TEXT-INDENT: 2em"><strong>3.将数据库中的表inner_notify、notify_staff_relat导出</strong>
<p style="TEXT-INDENT: 2em">exp aichannel/aichannel@TESTDB2 file= d:\data\newsmgnt.dmp tables=(inner_notify,notify_staff_relat)
<p style="TEXT-INDENT: 2em"><strong>4.将数据库中的表table1中的字段filed1以"00"打头的数据导出</strong>
<p style="TEXT-INDENT: 2em">exp system/manager@TEST file=d:\daochu.dmp tables=(table1) query=\" where filed1 like '00%'\"
<p style="TEXT-INDENT: 2em">上面是常用的导出，对于压缩，既用winzip把dmp文件可以很好的压缩。
<p style="TEXT-INDENT: 2em">也可以在上面命令后面加上compress=y来实现。
<p style="TEXT-INDENT: 2em">
<p style="TEXT-INDENT: 2em"><strong>数据的导入：</strong>
<p style="TEXT-INDENT: 2em"><strong>1.将D:\daochu.dmp 中的数据导入 TEST数据库中。</strong>
<p style="TEXT-INDENT: 2em">imp system/manager@TEST file=d:\daochu.dmp
<p style="TEXT-INDENT: 2em">imp aichannel/aichannel@HUST full=y file=file= d:\data\newsmgnt.dmp ignore=y
<p style="TEXT-INDENT: 2em">上面可能有点问题，因为有的表已经存在，然后它就报错，对该表就不进行导入。
<p style="TEXT-INDENT: 2em">在后面加上 ignore=y 就可以了。
<p style="TEXT-INDENT: 2em"><strong>2.将d:\daochu.dmp中的表table1导入</strong>
<p style="TEXT-INDENT: 2em">imp system/manager@TEST file=d:\daochu.dmp tables=(table1)
<p style="TEXT-INDENT: 2em"><strong>2.plsql:</strong>
<p style="TEXT-INDENT: 2em"><strong>数据导出:</strong>
<p style="TEXT-INDENT: 2em">TOOLS-Export user objects(用户对象)
<p style="TEXT-INDENT: 2em">TOOLS-Export tables(表)
<p style="TEXT-INDENT: 2em"><strong>数据的导入：</strong>
<p style="TEXT-INDENT: 2em">TOOLS-Import tables
<p style="TEXT-INDENT: 2em">Oracle Import(表) SQL Inserts(用户对象)
<p style="TEXT-INDENT: 2em">也可以将用户对象的语句拷贝出来，粘贴到Command Window这样的好处是可以看到执行的过程。 </p>
<img src ="http://www.cnitblog.com/szdlinxie/aggbug/48612.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/szdlinxie/" target="_blank">szdlinxie</a> 2008-09-02 10:23 <a href="http://www.cnitblog.com/szdlinxie/archive/2008/09/02/48612.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>项目进度计划方法</title><link>http://www.cnitblog.com/szdlinxie/archive/2008/08/29/48546.html</link><dc:creator>szdlinxie</dc:creator><author>szdlinxie</author><pubDate>Fri, 29 Aug 2008 15:19:00 GMT</pubDate><guid>http://www.cnitblog.com/szdlinxie/archive/2008/08/29/48546.html</guid><wfw:comment>http://www.cnitblog.com/szdlinxie/comments/48546.html</wfw:comment><comments>http://www.cnitblog.com/szdlinxie/archive/2008/08/29/48546.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/szdlinxie/comments/commentRss/48546.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/szdlinxie/services/trackbacks/48546.html</trackback:ping><description><![CDATA[<p><font face=Verdana>安排进度计划的目的是为了控制时间和节约时间，而项目的主要特点之一即是有严格的时间期限要求，由此决定了进度计划在<a href="http://www.miiceic.org.cn/phrase/200604240825565.html" target=_new><u><font color=#0000ff>项目</font></u><a onclick="javascript:tagshow(event, '%B9%DC%C0%ED');" href="javascript:;" target=_self><strong><u><font color=#0000ff>管理</font></u></strong></a></a>中的重要性。</font></p>
<p><font face=Verdana>基本进度计划要说明哪些工作必须于何时完成和完成每一任务所需要的时间，但最好同时也能表示出每项活动所需要的人数。常用的制定进度计划的方法有以下几种：</font></p>
<p><font face=Verdana>①关键日期表</font></p>
<p><font face=Verdana>这是最简单的一种进度计划表，它只列出一些关键活动和进行的日期。</font></p>
<p><font face=Verdana>②甘特图</font></p>
<p><font face=Verdana>也叫做线条图或横道图。它是以横线来表示每项活动的起止时间。甘特图的优点是简单、明了、直观，易于编制，因此到目前为止仍然是小型项目中常用的<a onclick="javascript:tagshow(event, '%B9%A4%BE%DF');" href="javascript:;" target=_self><u><strong><font color=#0000ff>工具</font></strong></u></a>。即使在大型工程项目中，它也是高级管理层了解全局、基层安排进度时有用的工具。</font></p>
<p><font face=Verdana>在甘特图上，可以看出各项活动的开始和终了时间。在绘制各项活动的起止时间时，也考虑它们的先后顺序。但各项活动上间的关系却没有表示出来，同时也没有指出影响项目寿命周期的关键所在。因此，对于复杂的项目来说，甘特图就显得不足以适应。</font></p>
<p><font face=Verdana>③关键路线法（Critical Path Method，简称CPM）。</font></p>
<p><font face=Verdana>④计划评审<a onclick="javascript:tagshow(event, '%BC%BC%CA%F5');" href="javascript:;" target=_self><u><strong><font color=#0000ff>技术</font></strong></u></a>（Program Evaluation and Review Technique，简称PERT）。</font></p>
<p><font face=Verdana>CPM 和PERT是50年代后期几乎同时出现的两种计划方法。随着科学技术和生产的迅速发展，出现了许多庞大而复杂的科研和工程项日，它们工序繁多，协作面广，常常需要动用大量人力、物力、财力。因此，如何合理而有效地把它们组织起来，使之相互协调，在有限资源下，以最短的时间和最低费用，最好地完成整个项目就成为一个突出的重要问题。CPM和PERT就是在这种背景下出现的。这两种计划方法是分别独立发展起来的，但其基本原理是一致的，即用<a onclick="javascript:tagshow(event, '%CD%F8%C2%E7');" href="javascript:;" target=_self><u><strong><font color=#0000ff>网络</font></strong></u></a>图来表达项目中各项活动的进度和它们之间的相互关系，并在此<a onclick="javascript:tagshow(event, '%BB%F9%B4%A1');" href="javascript:;" target=_self><u><strong><font color=#0000ff>基础</font></strong></u></a>上，进行网络分析，计算网络中各项时间多数，确定关键活动与关键路线，利用时差不断地调整与优化网络，以求得最短周期。然后，还可将成本与资源问题考虑进去，以求得综合优化的项目计划<a onclick="javascript:tagshow(event, '%B7%BD%B0%B8');" href="javascript:;" target=_self><u><strong><font color=#0000ff>方案</font></strong></u></a>。因这两种方法都是通过网络图和相应的计算来反映整个项目的全貌，所以又叫做网络计划技术。</font></p>
<p><font face=Verdana>此外，后来还陆续提出了一些新的网络技术，如GERT（Graphical Evaluation and Review Technique，图示评审技术），VERT（Venture Evaluation and Review Technique，风险评审技术）等。</font></p>
<p><font face=Verdana>很显然，采用以上几种不同的进度计划方法本身所需的时间和费用是不同的。关键日期表编制时间最短，费用最低。甘特图所需时间要长一些，费用也高一些。CPM要把每个活动都加以分析，如活动数目较多，还需用<a href="http://www.miiceic.org.cn/phrase/200603021438435.html" target=_new><u><font color=#0000ff>计算机</font></u></a>求出总工期和关键路线，因此花费的时间和费用将更多。PERT法可以说是制订项目进度计划方法中最复杂的一种，所以花费时间和费用也最多。</font></p>
<p><font face=Verdana>应该采用哪一种进度计划方法，主要应考虑下列因素：</font></p>
<p><font face=Verdana>①项目的规模大小。很显然，小项目应采用简单的进度计划方法，大项目为了保证按期按质达到项目目标，就需考虑用较复杂的进度计划方法。</font></p>
<p><font face=Verdana>②项目的复杂程度。这里应该注意到，项目的规模并不一定总是与项目的复杂程度成正比。例如修一条公路，规模虽然不小，但并不太复杂，可以用较简单的进度计划方法。而研制一个小型的电子仪器，要很复杂的步骤和很多专业知识，可能就需要较复杂的进度计划方法。</font></p>
<p><font face=Verdana>③项目的紧急性。在项目急需进行，特别是在开始阶段，需要对各项工作发布指示，以便尽早开始工作，此时，如果用很长时间去编制进度计划，就会延误时间。</font></p>
<p><font face=Verdana>④对项目细节掌握的程度。如果在开始阶段项目的细节无法解明，CPM和PERT法就无法<a onclick="javascript:tagshow(event, '%D3%A6%D3%C3');" href="javascript:;" target=_self><u><strong><font color=#0000ff>应用</font></strong></u></a>。</font></p>
<p><font face=Verdana>⑤总进度是否由一、两项关键事项所决定。如果项目进行过程中有一、两项活动需要花费很长时间，而这期间可把其他准备工作都安排好，那么对其他工作就不必编制详细复杂的进度计划了。</font></p>
<p><font face=Verdana>⑥有无相应的技术力量和设备。例如，没有计算机，CPM和PERT进度计划方法有时就难以应用。而如果没有受过良好训练的合格的技术人员，也无法胜任用复杂的方法编制进度计划。</font></p>
<p><font face=Verdana>此外，根据情况不同，还需考虑客户的要求，能够用在进度计划上的预算等因素。到底采用哪一种方法来编制进度计划，要全面考虑以上各个因素。</font></p>
<p><font face=Verdana></font>&nbsp;</p>
<img src ="http://www.cnitblog.com/szdlinxie/aggbug/48546.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/szdlinxie/" target="_blank">szdlinxie</a> 2008-08-29 23:19 <a href="http://www.cnitblog.com/szdlinxie/archive/2008/08/29/48546.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>成功的团队管理是项目成功的基础</title><link>http://www.cnitblog.com/szdlinxie/archive/2008/08/29/48545.html</link><dc:creator>szdlinxie</dc:creator><author>szdlinxie</author><pubDate>Fri, 29 Aug 2008 15:15:00 GMT</pubDate><guid>http://www.cnitblog.com/szdlinxie/archive/2008/08/29/48545.html</guid><wfw:comment>http://www.cnitblog.com/szdlinxie/comments/48545.html</wfw:comment><comments>http://www.cnitblog.com/szdlinxie/archive/2008/08/29/48545.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/szdlinxie/comments/commentRss/48545.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/szdlinxie/services/trackbacks/48545.html</trackback:ping><description><![CDATA[<p><font face=Verdana>对于许多<a onclick="javascript:tagshow(event, '%CF%EE%C4%BF');" href="javascript:;" target=_self><u><strong><font color=#0000ff>项目</font></strong></u></a>经理而言，项目<a href="http://www.miiceic.org.cn/phrase/200603082251135.html" target=_new><u><font color=#0000ff>团队</font></u></a>管理恐怕是他们所面临的最头疼的问题之一，而团队管理恰恰又是<a href="http://www.miiceic.org.cn/phrase/200604240825565.html" target=_new><u><font color=#0000ff>项目管理</font></u></a>过程中最重要的部分之一：尽管成功的团队管理不一定能保证项目的成功，但失败的团队管理必然导致项目的失败。在一个项目团队中，有各种不同的人员，他们具有不同的背景，有着不同的特长，也具有不同的性格特征。如何充分发挥每一位团队成员的积极性和特长，并保证这些积极性和特长的发挥能够与项目目标保持一致，是每位项目经理在团队管理中所必须处理好的问题。有趣的是，我们在中国的古典小说《西游记》中找到了这样一个非常生动、非常成功的案例。</p>
<p>&nbsp;&nbsp;&nbsp; 让我们来看看《西游记》中的&#8220;项目团队管理&#8221;。</p>
<p>&nbsp;&nbsp;&nbsp; 在《西游记》中，唐僧师徒四人历经千难万险，从&#8220;东土大唐&#8221;出发，最终完成&#8220;西天取经&#8221;的任务。从项目管理的眼光来看，这本身就是一个项目的<a onclick="javascript:tagshow(event, '%CA%B5%CA%A9');" href="javascript:;" target=_self><u><strong><font color=#0000ff>实施</font></strong></u></a>过程，也符合项目的一般特征，即&#8220;特定性&#8221;(项目任务为&#8220;西天取经&#8221;，项目交付物为&#8220;佛经&#8221;)和&#8220;过程性&#8221;(完成取经任务，提交项目交付物———&#8220;佛经&#8221;之后，该项目即宣告结束)。任务完成过程中的其他要素也很齐全：包括项目交付物的&#8220;受益人&#8221;(唐朝皇帝)、项目的&#8220;资助人&#8221;(如来佛祖)、项目实施过程中的支持保障体系(各位神仙)等。</p>
<p>&nbsp;&nbsp;&nbsp; 《西游记》中的&#8220;项目团队&#8221;也很符合项目团队的一般特征：唐僧师徒四人构成了项目实施团队，其团队成员有着不同背景、能力和性格特征；而唐僧这位团队领导人也面临着许多项目经理在团队管理中所面临的一般问题：</p>
<p>&nbsp;&nbsp;&nbsp; 项目团队成员并不是他自己挑选的，而是项目实施组织的管理机构指派给他的。唐僧的三个徒弟，甚至包括白龙马，都是&#8220;上级领导&#8221;观音菩萨在他出发前确定的；换句话说，他没有&#8220;选人权&#8221;。</p>
<p>&nbsp;&nbsp;&nbsp; 项目团队成员的<a onclick="javascript:tagshow(event, '%BC%BC%CA%F5');" href="javascript:;" target=_self><u><strong><font color=#0000ff>技术</font></strong></u></a>能力都强于他(至少都能腾云驾雾，论武功更是个个比他强)，都有一定的来头(原来都是天宫中大将以上职位)，个别人还有一定的管理经历(如猪八戒曾是水军元帅)。</p>
<p>&nbsp;&nbsp;&nbsp; 团队成员业务能力和工作态度各异，有业务能力强但心高气傲的(如孙悟空)，有业务能力中等但工作态度不认真、不积极，&#8220;推一下动一下&#8221;的(如猪八戒)，也有尽管勤勤恳恳、任劳任怨但业务水平较差的(如沙僧)，如何将这些人组成一个具有战斗力的团队是一个大难题。</p>
<p>&nbsp;&nbsp;&nbsp; 尽管名义上有一定的&#8220;行政权力&#8221;，如&#8220;惩罚权&#8221;(念&#8220;紧箍咒&#8221;)、&#8220;解聘权&#8221;(将徒弟撵走)等，但自己也知道缺了这些人(尤其是业务能力强但心高气傲的那位)项目就无法完成；况且&#8220;绩效考核权&#8221;和&#8220;奖励权&#8221;都在上级领导手中(取经完成后的封赏工作都是如来佛祖负责的，唐僧连&#8220;建议权&#8221;都没有)。</p>
<p>&nbsp;&nbsp;&nbsp; 但就是这位缺乏&#8220;行政权力&#8221;，&#8220;技术能力&#8221;也不强的唐僧，带着这个团队完成了常人看起来难以完成的任务。由此看来，作为&#8220;项目经理&#8221;，唐僧确实有许多值得学习之处。</p>
</font>
<img src ="http://www.cnitblog.com/szdlinxie/aggbug/48545.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/szdlinxie/" target="_blank">szdlinxie</a> 2008-08-29 23:15 <a href="http://www.cnitblog.com/szdlinxie/archive/2008/08/29/48545.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>