in

SDT Community Server

SDT Forums, Blogs, Photos server.

This Blog

Syndication

News

No news is good news.

Resources

Floating Heart

No description is bad.
  • Using FastCGI to Host PHP Applications on IIS 7

    Posted Aug 28 2010, 09:10 AM by wicky with no comments
    Filed under:
  • 利用SSH+FireFox实现完美翻墙


    本文链接:http://www.cfresh.net/pc-tech/662

    友情链接:通过SSH利用Tunnelier+Privoxy实现任意浏览器翻墙

      臣本屁民,蜗居于天朝,苟全性命于网络,不求闻达于四海。
            敢封哥的网,先从哥的尸体上跨过去! 

           扯淡完毕,切入正题。
           翻墙术大概分这么几种:
           修改hosts文件,https(SSL)安全浏览,在线代理,VPN,SSH等。
           这里秋天选择一种:SSH来讲解,此方法以FireFox配合为例,采用SSH+Tunnlier+firefox+AutoProxy实现完全无障碍翻墙,其他应用举一反三。 


           第一步,SSH账号的获得
           首先,要拥有一个SSH账号,方法有很多种:网上搜索可得,购买空间可得,免费注册可得 etc.
           购买很多国外的空间都会赠送SSH账号;当然也有免费的午餐。

           ======================2010.8.4更新======================

           根据众多网友的反映,由于本文原本提及的cjb.net网站免费ssh服务后来出现不稳定的情况,秋天不再做推荐。在此可以使用另一高速且无需注册的SSH账号服务:Shellmix,根据秋天的试用,试用此SSH通过直接SSH转socks代理后在firefox下观看电影几乎不需缓冲。如果发现Shellmix服务不可用,请自行在Google上搜索”free ssh account”寻找新的免费SSH服务。

           Shellmix提供了两个免费SSH账号,对应不同的服务器,服务器端口均为30,详情如下:

           SSH账号1主机地址:shellmix.com
           登录账号:newusershell
           登录密码:newusershell

           SSH账号2主机地址:fgfg.pl
           登录账号:newuser
           登录密码:newuser

           至此,你已经又有了一个长期有效且免费的SSH账号了,接下来看如何配合FireFox使用。 

           PS,有人会问:你不是Opera的忠实粉丝吗?
           答:为了在方便调试博客(www.cfresh.net)和一些其他临时用途,秋天装了一个绿色版FF备用。 

           ======================2010.5.15更新======================

           由于MyEnTunnel使用Plink核心,存在连接不稳定和转化效率低的情况,现推荐使用Tunnlier替代MyEnTunnel作为SSH客户端,其余步骤配置仍同本文。如果你的网络浏览器/软件不支持Socks代理,请移步另一篇文章:通过SSH利用Tunnelier+Privoxy实现任意浏览器翻墙

           第二步,使用客户端软件Tunnlier连接SSH
           软件下载地址:
            安装版:http://dl.bitvise.com/Tunnelier-Inst.exe
            绿色版:http://tp.vbap.com.au/download       

            安装版安装完成后,启动软件,来到如图所示界面,依次输入SSH服务器地址、用户名、端口(shellmix使用30端口,一般空间提供的SSH为22端口)、密码,并勾选”Password”下的”Store encrypted password in profile”,如图:

             接下来切换到”Options”选项卡,进入选项配置
            因为Tunnelier默认在连接SSH服务器时开启SFTP和命令行SSH终端,如果你并不需要可以在”On Login”下框选取消”Open Terminal”和”Open SFTP”。

            继续切换到”Services”选项卡,进入服务配置
            勾选”SOCKS/HTTP Proxy Forwarding”下的”Enabled”选项框,第一行监听地址输入127.0.0.1,第二行监听端口输入socks转发端口,如1080,第三行保持0.0.0.0不变。再点左侧的”Save Profile As”按钮,将当前的配置保存为文件方便以后软件启动时调用。 

            至此SSH客户端Tunnelier设置完成,接下来开始安装Firefox插件。

           第三步,配置FireFox
           给FireFox添加插件:”AutoProxy”,此插件专门为应对GFW而生,在此大力表扬一下软件作者!
           添加完毕后重启FF,然后你会看到一个对话框,选择gfwlist (P.R.China)后,点击”确定”。 


           接着你会看到Firefox主界面右下角出现有一个“福”字图案,点击“福”,然后点击菜单”代理服务器”–”编辑代理服务器”      

            这时会看到它提供了很多种代理方式,如Tor、GappProxy、Puff等,需要注意的是将”ssh -D”代理端口设置与My Encrypted Tunnel端口(非SSH端口)保持一致(7070)。

           点击”确定”回到插件设置主界面,点击”代理服务器”–”选择代理服务器”,在”主代理”下拉菜单中选择”ssh -D”,返回插件主界面,接着”确定”。       

           这时再打开你的FF,空气是不是清新多了? 

           顺便提一下秋天利用GAE搭建的两个代理类API:
           1,支持https安全访问的在线代理服务器:https://flow-proxy.appspot.com(注:该程序不支持cookies);
           2,一个twitter代理API:http://x-flow.appspot.com/ 

    Posted Aug 06 2010, 03:12 PM by wicky with no comments
    Filed under:
  • showModalDialog下载文件问题

    http://hi.baidu.com/zangchunlai/blog/item/3007f419bcb26670dbb4bd6f.html

    showDialog里好像不能用href,只能用onclick

    最近在项目中经常用到模态窗口(showModalDialog),客户需要在一个模态窗口中有"生成Excel报表"并"导出"的功能。接到任务后,直接就开始按常规操作实现。
        在按钮的Click事件中,根据模板生成Excel报表,填充数据,保存到临时文件夹,然后用Response.WriteFile函数输出文件,一切看上去都很顺利。代码如下:

                //根据数据集创建Excel报表并返回Excel报表路径
                string fileName = CreateExcel(ds);
                Response.Clear();
                Response.Charset = "utf-8";
                Response.Buffer = true;
                this.EnableViewState = false;
                Response.ContentEncoding = System.Text.Encoding.UTF8;
                Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
                //设置输出文件类型为excel文件。
                Response.ContentType = "application/ms-excel";
                Response.WriteFile(fileName);
                Response.Flush();
                Response.Close();
                Response.End();

        但是当完成了代码,开始测试的时候,却发现点击"导出"按钮没有反应。开始的时候以为是创建Excel报表的代码有问题,但经过调试后,证实创建Excel代码没有问题,也成功的在临时文件夹下生成了Excel报表,但是却没有"导出"报表(没弹出下载文件对话框)。再看输出文件的代码,应该也没有问题,之前一直这样输出都没有问题的。
        在百思不得其解的时候,发现了一个关键点。就是之前输出文件成功的面页都是一般的网页窗口,而这次的操作却是在模态窗口中。问题会不会出在这里呢?赶紧试验了一下。把模态窗口改成了一般的网页窗口,果然可以输出文件没问题,也成功下载了报表。
        虽然问题有点怪异,但找到了切入点和问题的关键所在,解决应该就不难了。google一下,发现模态窗口定义了<base target="_self">,这应该是问题所在。然后在页面中重新定义了这个标签,改成了<base target="_blank">,问题成功解决,文件可以正常下载了。但这时候又来了新的问题,下载是可以了,但是却会弹出一个新页面,在模态窗口中下载再弹出页面肯定影响了用户体验。有没有方法在模态窗口中直接下载而不弹出新的页面呢?既然target=_self的时候有问题,target=_blank的时候又会弹出新的页面,这让我想到了在框架中打开新窗口的做法。在页面中加一个看不到的框架,然后把target设为框架名应该可以解决。随后在页面中再加了一个大小为0的iframe

    <iframe id="download" name="download" height="0px" width="0px"></iframe><!--用iframe模拟文件下载-->
    然后重新修改<base>标签target为框架名:

    <base target="download">
    重新生成,浏览,测试。问题成功解决。

    Posted Jul 15 2010, 02:00 PM by wicky with no comments
    Filed under:
  • Windows2008R2远程桌面服务之配置远程桌面授权

    http://hi.baidu.com/longx5/blog/item/508357112f2fe18b6538db96.html

    Per User; Enterprise License; 4954438; 300

     

    Posted Jun 26 2010, 04:26 PM by wicky with no comments
    Filed under:
  • Aero Glass on Remote Desktop Services?


    http://ts2blogs.com/blogs/rwagg/archive/2009/09/04/aero-glass-on-remote-desktop-services.aspx

    As you’ve already read, we’ve renamed Terminal Services to Remote Desktop Services (RDS) in Windows Server 2008 R2. RDS also gives us the ability to leverage Aero Glass from a Remote Desktop Connection.  This is a multi-step process, but there are really two phases.  Phase I is enabling the Desktop Experience functionality on a Server 2008 R2.  Phase II is enabling the Remote Desktop Services functionality on the server.  While an Administrator is able to have one RDP connection to a server, Aero functionality is not enabled until the Remote Desktop Host role is enabled.  I’ve provided a lot of screen shots and narrative as I walk through the process of enabling RDS and the Aero Glass functionality.

    Phase I

    Install the desktop experience by adding the Desktop Experience feature.

    image

    As you go through this wizard, when you choose the Desktop Experience it will ask you to confirm the installation of the Ink and Handwriting Services as well.  This is required, just choose Add Required Features and move on.

    image

    During the installation of the Desktop Experience feature, the server will require a reboot.  Once the server is rebooted and you log back in, you’ll be presented with the Installation Results screen.

    image

    Now that you’ve installed the Desktop Experience feature, you need to enable the Themes service.  Go into your services and now this Themes service shows up, but it’s disabled.  Set it to Automatic and then go ahead and start the service.

    image

    At this stage, you’ll have the Windows Desktop experience installed on the server.  To take advantage of it from a Remote Desktop Connection, you need to ensure that you’ve enabled 32 bit colors and the Desktop Experience functionality in your RDP connection, as shown below.

    Under Colors, choose Highest Quality (32 bit)

    image

    Take note that Aero over RDP is bandwidth intensive, so I’d suggest that you not try to use this functionality over a WAN. 

    image

     

    Phase II – Enabling Remote Desktop Service Role (RDS).

    You have to enable RDS on your server anyway if your providing Remote Desktop Services to your users.  You also need RDS to be installed if you want to use Aero Glass.

    Install the Remote Desktop Services Role

    image

    Now you get to choose the detailed functionality in RDS that you want to leverage.

    image

    You need to enable Remote Desktop Session Host if you want Aero Glass, and then we will configure the additional services to be delivered, including the Client Experience.  This is where we get to define the detail of the client experience. 

    image

    Once everything is configured you can confirm that Aero Glass is now enabled on your server in a few different ways.  The first is the obvious, check out the transparent windows in your Remote Desktop connection.  The second way is that the Windows Color screen on the Personalization menu is now “different” than it was prior to the installation of the client experience. 

    image

    Here’s a shot of the new Windows Color screen that now includes the Enable transparency check box.

    image

    Below is a shot of the old screen, before Aero Glass is enabled.  Take note: this “old screen” is still available after the Aero installation, it’s accessed by choosing Advanced appearance settings… from the Windows Color and Appearance window (above).

    image

    Now that we have everything enabled, let me show you a screen shot of the Windows Server 2008 R2 desktop with Aero Glass enabled.

    image

    Here’s a shot of Aero Peek on the same Server 2008 R2 server.

    image

    I hope this helps you setup your remote desktop connections with the same desktop experience as a Windows 7 Desktop.  Remember that with Aero over a Remote Desktop connection, bandwidth is critical.  A LAN connection will provide a much better experience than a WAN connection.

    Until next time,

    Rob

    Posted Jun 26 2010, 03:20 PM by wicky with no comments
    Filed under:
  • How to extend the size of VMware disk file on VMware Server or Workstation

    Step 1

    On your VMware Windows host, open a command prompt window by clicking Start --> Programs or All Programs --> Accessories --> Command Prompt or choosing Start --> Run --> type 'cmd' --> press Enter or click 'OK'.

     

    Step 2

    Next, change directories to where your VMware server or workstation application files are installed. In this example we will use VMware Workstation. At the command prompt type: cd c:\program files\vmware\vmware workstation and press 'Enter'

    Step 3

    Run VMware vdiskmanager by typing the following:
    C:\program files\vmware\vmware workstation\vmware-vdiskmanager -x 50Gb c:\my virtual machines\windows xp\windows.vmdk, press Enter. This will expand the VMDK file windows.vmdk located in the directory c:\my virtual machines\windows xp\ to 50 gigabytes.

    (Note: on linux, normally it's /usr/bin/vmware-vdiskmanager)

    Step 4

    You must now wait for the expansion to complete. A progress indicator will be displayed. When the process is complete, type 'exit' to close the command prompt window.

    Step 5

    Insert a Windows PE or BartPE CDROM into your CD/DVD drive or edit the virtual machine settings, select CD/DVD and attach an .ISO image file of one of the above cd's.

    Step 6

    Boot your virtual machine and quickly press F2 to enter the BIOS. Once in the BIOS make sure the CD/DVD is set ahead of the local hard disk in the Boot Order screen. Save your changes and exit the BIOS.

    Step 7

    Once the Windows PE or BartPE CD starts, open a command prompt and type the following:

    c:\>DISKPART --> press Enter
    DISKPART> type 'list disk' --> press Enter
    DISKPART> type 'list volume' --> press Enter
    DISKPART> type 'select volume=#' (where # is the number of the volume you wish to extend) --> press Enter
    DISKPART> type 'extend' --> press Enter to extend the disk file.
    DISKPART> type 'exit' --> press Enter to exit diskpart.

    Step 8

    Shutdown and reboot the virtual computer for the changes to take effect

    Posted Jun 09 2010, 09:50 AM by wicky with no comments
    Filed under:
  • Get the Show Desktop icon back in Windows 7

    http://www.thewindowsclub.com/get-the-show-desktop-icon-back-in-windows-7-taskbar#ixzz0qEKTQtMc 

    While you have Show desktop transparent vertical bar at the right side end of the taskbar which also adds the functionality of Desktop Peek, it appears that there are some who miss the old Show desktop icon which appeared on the left side of the taskbar.

    To get it back, simply follow these steps in the order mentioned:

    1. Copy-paste the following in a Notepad and save it as Show desktop.scf on your desktop.

    [Shell]
    Command=2
    IconFile=explorer.exe,3
    [Taskbar]
    Command=ToggleDesktop

    2. Assuming that your Windows 7 is installed on C Drive, cut-paste this Show desktop.scf file in folder:
    C:\Users\%Username%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\Taskbar. To open this folder, simply copy paste this address in the explorer address bar and hit Enter.

    3. Now create any temporary shortcut of  anyone of your other (.exe) applications on your desktop. Rename it to Show Desktop.

    Next, right click on it and select Change icon.
    Select the Show Desktop icon from the following folder :
    C:\Windows\System32\imageres.dll
    Click Apply > OK.
    NOW right click and Pin to Taskbar. Then you can remove this icon.

    4. Now right click on this shortcut icon pinned in C:\Users\%Username%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\Taskbar directory and select its Properties.

    5. In the Shortcut tab, change its Target to:

    C:\Users\%Username%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Show desktop.scf

    You will now get the Show desktop icon in the Windows 7 in the location it should be and it will look & behave the way it should look & behave! Drag and drop it to the desired position.

    Alternatively, you may also want to check out these freeware

    (1) Show Desktop Button for Windows 7 that will enable the same feature in Windows 7
    and allows you to pin it to the taskbar (2) Show desktop software will minimize all open windows to display the desktop.
     
    Or, you can press Windows Key + D if you like keyboard.
     
     

     
    Posted Jun 08 2010, 11:47 AM by wicky with no comments
    Filed under:
  • Change Windows 7 Logon Background Image


    1. press win+r key and Type Regedit at run prompt

    2. Locate following registry key

    HKLM\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background

    3. Now in right-side pane, change value of OEMBackground to 1.

    4. Now place your custom image in %windir%\system32\oobe

    5. Create a new folder info and background within newly created info folder

    Folder path should look like this %windir%\System32\oobe\info\backgrounds

    6. Now place your desired logon wallpaper within this background folder with file name as backgroundDefault.jpg

    Images Name with resolutions

    backgroundDefault.jpg

    background768×1280.jpg (0.6)

    background900×1440.jpg (0.625)

    background960×1280.jpg (0.75)

    background1024×1280.jpg (0.8)

    background1280×1024.jpg (1.25)

    background1024×768.jpg (1.33-)

    background1280×960.jpg (1.33-)

    background1600×1200.jpg (1.33-)

    background1440×900.jpg (1.6)

    background1920×1200.jpg (1.6)

    background1280×768.jpg (1.66-)

    background1360×768.jpg (1.770833-)

    Please NOTE: Images must be less than 256kb in size

    The backgroundDefault.jpg image is loaded and stretched-to-fit when a resolution/ratio specific background cannot be found.

     

    Posted Jun 08 2010, 10:00 AM by wicky with 1 comment(s)
    Filed under:
  • Tuning Physical Standby

    Tuning Physical Standby part I

    PDRTJS_settings_1037596_post_27 = { "id" : "1037596", "unique_id" : "wp-post-27", "title" : "Tuning+Physical+Standby+part+I", "item_id" : "_post_27", "permalink" : "http%3A%2F%2Fcoskan.wordpress.com%2F2007%2F03%2F06%2Ftuning-phsical-standby-part-i%2F" } In my opinion tuning dataguard can be analyzed under two topics

    1- Tuning network
    a-
    Is the network bandwidth sufficient for the redo rate?

    If your redo size and redo generation rate is high for bandwith between primary and standby server you have to check your network if you cant decrease the size of redo and redo generation rate.

    For calculating the bandwidth need you can do the following calculation.

    Required bandwidth
    = ((Redo rate in bytes ps / .7) * 8 ) / 1000000 = bandwidth in Mbps

    for example if your redo rate per second is 500 bytes then you need
    = ((500 * 1024) / .7) * 8 ) / 1000000=5.8 MBps

    If you bandwith below 5.8 MBps then

    you can get your redo rate ps from a statspack or awr report taken for a peek time period.

    b- If the network is sufficent then check that there are no network errors or collisions on the primary and the standby

    Use the ‘netstat’ command on the primary and the standby to validate that no network errors or collisions are occurring. You must get zero from the output of netstat commands collision column

    C:\Documents and Settings\cgundogar>netstat -e
    Interface Statistics

    Received Sent

    Bytes 3953227193 1644532922
    Unicast packets 23348932 15441759
    Non-unicast packets 157696847 1061
    Discards 0 0
    Errors 0 0
    Unknown protocols 1396632

    use netstat -i for unix or solaris OS

    2- Tuning log apply process

    a- If you have multiple CPU on your machine then parallelize the log apply process

    SQL>alter database recover managed standby database parallel N disconnect;

    max(N)=number_of_CPU*2

    b- You can disable DB_BLOCK_CHECKING parameter for fast redo apply.
    SQL> alter system set DB_BLOCK_CHECKING=FALSE;

    System altered.

    c- You can increase PARALLEL_EXECUTION_MESSAGE_SIZE from 2148 to 4096. (parameter can not be set dynamically )
    SQL> alter system set PARALLEL_EXECUTION_MESSAGE_SIZE=4096 scope=spfile;

    System altered.

    d- If your system supports ASYNC I/O then enable it with setting the parameter DISK_ASYNCH_IO to TRUE. If ASYNC I/O is not supported then increase your db_writer processes by increasing .db_writer_processes parameter to higher value.

    SQL> alter system set DISK_ASYNC_IO=true scope=spfile;

    System altered.

    SQL>alter system set db_writer_processes=2 scope=spfile;

    System altered.

    !!!!As an advice for health testing try each change one by one for seeing the effect of each parameter change operation.

    Referances Used:

    Metalink Note ID: 241925.1 Troubleshooting 9i Data Guard Network Issues

     

    Posted May 18 2010, 09:04 AM by wicky with no comments
    Filed under:
  • IT职场求生法则

    IT职场求生法则
    http://www.cnblogs.com/umlonline/archive/2010/05/10/1731741.html

    摘要:

    我在IT职场打滚超过10年了,从小小的程序员做到常务副总。相对于其它行业,IT职场应该算比较光明的了,但也陷阱重重,本文说说我的亲身体会,希望大家能在IT职场上战无不胜!

     

    作者:张传波

    软件知识大学

    www.umlonline.cn/school/


    正文:

    我会先先说一些无论是你在什么职位都适用的通用法则,然后专门针对不同职位讲讲应该注意的求生法则。

    通用法则

    法则1:忍耐是一种美德。
    为了生活,很多时候你必须要忍!忍受你的领导对你的无理责骂、同事的白眼、客户的无理取闹,承受工作的巨大压力,忍受上下班的拥挤、堵车,忍受什么都涨就是工资不涨,……
    不要因为一时之气而因小失大,当然忍耐是为了以后的反击,老子不需要卧薪尝胆十年,你只需要忍耐1-2两年,你就会有反击的机会!

    法则2:不要威胁到你的老板。
    这里说的“老板”泛指你的领导、领导的领导、直到公司的老板。
    功高盖主历来是做大臣的大忌,不想莫名其妙地被干掉,千万要做到韬光养晦。让你的老板能晋升,然后你才晋升到老板的位置,才是你的升职之道!任何想踩你老板的头上位的想法和行动,都是愚蠢的,除非你足够奸诈。

    法则3:你要很“爱”公司。
    很多公司喜欢搞一些活动,如:旅游、聚餐、拓展活动等等,美名其曰:增进大家的感情、公司归属感。如果在上班时间搞而且公司费用全包,大家当然非常乐意。但公司往往为了所谓的不影响工作,将时间安排在非上班时间。有些公司要求所有员工务必参加,而有些公司会非常有人情味地说:因为是非上班时间,确实有事的员工可以不来。听了后你不要很开心,这是一个巨大的陷阱,这些所谓的公司活动,是老板摆排场的一种手段而已,所有话都是冠冕堂皇的,你敢不来自然会有人记住,以后再跟你慢慢算账。
    其实咱们上班都这么辛苦了,周末总想好好休息好好娱乐一番,但如果不幸公司在这些时间安排活动,那你必须体现得很“爱”公司,为了“爱”公司,可以牺牲自己的个人生活!

    法则4:有时你必须做“装假狗”。
    咱们做软件开发的,都是很坦诚很直率的人,不屑于做虚伪的东西。但是阿谀奉承、蒙上欺下的事情经常在我们身边发生,有时候你会成为人家的棋子来做这些虚伪的事情。
    你有三个选择:
    1)同流合污,狼狈为奸。
    2)绝不作假,代价就是你要做烈士。
    3)中间路线,做“装假狗”。
    你不想同流合污,又不想做烈士,“装假狗”是选好的选择,在夹缝中生存,忍耐中等待机会。还有一点要记住:千穿万穿,马屁不穿!就算你拍马屁功夫不一流,也需要学两招防身。

    法则5:服从而且绝不越权。
    如果你不同意你的领导决策,你可以提出你的想法,如果你的领导还是坚持他的想法,哪怕你觉得很不妥,你也必须坚决执行,绝对不能干阳奉阴违的事情。你的领导和你是信息不对称的,有些决策的依据,你的领导并不方便告诉你。越权,特别是越你直接领导的权,是超级大忌!不要擅作主张,应该请示的还是必须请示。

    法则6:不断充电。
    不断充电是最重要的法则,利用任何机会、上下班时间来学习过硬的赚钱本领。有一技之长来防身,这是硬道理。如果你掌握了公司的核心技术、掌握了重要的营销渠道、掌握了公司赚钱的某一命脉,你在公司“打横走”都没有人敢动你了。不断充电,你将有更多的筹码,可以做更多的选择。

    你是基层员工!

    法则7:认识你的职位价值。
    IT公司基层职位一般就是:程序员、测试工程师、实施工程师、配置管理员、质量保证工程师等等。如果公司要裁员,基层员工绝对是占最大的裁员比例。而这些基层职位的重要性也是有排序的,由重要到不重要一般排序如下:程序员、测试工程师、实施工程师、配置管理员、质量保证工程师。越不重要的职位,就越容易被干掉。
    写代码永远是比其它基层职位要更重要一点的,如果你是公司老板,要逐一拿掉不重要的职位,最后剩下的肯定是开发职位。如果你刚从事软件行业,如果你不想做销售,那么建议你从程序员开始。如果你对写代码没有兴趣,选择了其它职位,你要清楚认识到你的职位价值,也不需要抱怨,与其抱怨,不如在工作中不断提升你的职位价值。

    法则8:多说多做。
    “少说多做”是一种工作美德吗?你千万不要以为是这样!如果“多说少做”,你只会成为夸夸其谈、言过其实之辈;而“少说多做”你就会成默默耕耘的老黄牛,一辈子被人驱使;不仅要有实际的工作表现,也需要主动表现你的工作才华、工作成绩,“多说多做”才是成功之道。
    不少开发人员不善词语、文字表达能力也不高,如果你是这样就要注意逐步改善了,平时多多主动沟通,主动写一些项目文档,有空写写博客,提高你的口头及文字表达能力。技术强,再加上表达能力强,你将会战无不胜!

    你是项目经理!

    法则9:尽量不做不可能成功的项目。
    领导喜欢“拍肩膀”将项目托付给你,你不要自鸣得意,很多时候是一个巨大的坑等着你去跳。很多项目是“拍脑袋”诞生的,这样注定一些项目是不可能成功的,如果你做这样的项目,无论你是如何厉害,都逃不过失败的命运。而项目经理是以成败论英雄的,很多人等着这个机会放你的冷箭,不要因此而一世英名一朝丧。
    如何才能避免做不可能成功的项目呢?
    料敌先机是关键!你平时就要留意公司最近可能会有什么新项目,这些项目的背景是怎样的,从大势上判断这些项目的成功机会。如果这个不可能成功的项目可能会落到你的头上,你就要想办法“借故推辞”,你绝对不能直接说你不想做这个项目,你有这样的办法:
    1)主动先承担另外一个有机会成功的项目,让自己无法抽身。
    3)制造你当前工作很忙的假象,让你领导无法安排你做新项目。
    4)新项目将落实之际,想办法出差。
    5)请假!病假、婚嫁、产假什么的都行。
    6)还有一个阴招:让别人去送死。这个项目总归要有人负责,你不上就想办法让别人上就可以了。
    如果真的无法推辞怎么办?
    你还是要尽力做好这个项目,但你要随时把这个项目的问题、困难、进展情况等报告给你的领导和相关人员,隐瞒问题绝对不是办法,干脆就一开始就暴露问题,降低领导的期望值,总好过最后你给一个“惊喜”给你的领导,你会死得很惨。

    法则10:趁机索权。
    项目经理往往是责任最大、但权力不大、可用资源不多的职位。领导“拍肩膀”托付项目给你知识,就是你趁机索取权力的最好时机!这时领导有求于你,绝对不会恶言相向,只要你注意分寸,成功机会很大!你可以要求增加人员、资源,要求某某部门配合等等。

    法则11:尝试不同项目。
    你要选择各种不同类型的项目来锻炼自己,让自己羽翼丰满。只要不是不可能成功的项目,而自己还没有尝试过的类型,你都可以尝试。短短两三年,你就可以成为经验丰富的项目管理大牛。

    法则12:占领最有价值产品线。
    如果你想在公司长期发展,你必须有计划地去领导最有价值的项目、最有价值的产品开发。让公司最赚钱的项目或产品线,在你的掌控之下,这样你可以获得更大的权力和更多的收入!
    但要注意,实践这个法则的同时,你可能会违反另外一个法则“不要威胁到你的老板”。软件公司可能是最容易另起炉灶的公司了,公司中某些开发人员脱离原来的公司,另起炉灶,将原来的公司干掉,这样的事情层出不穷,所以你的老板一定会防住你的!无论你是否有“另起炉灶”之心,都不能显露出来,而且你要时不时显露对老板的忠心。
    如果你才华太出众,而又不会讨老板欢心,那么你可以会经常被委派做一些不太核心的项目,公司没有再值得留恋的地方时,你要选择另谋高就了!

    你是部门经理!

    法则13:做最有价值的部门。
    公司设定这样的部门,自然有相应的定位。你成为该部门的一把手,你要想方设法让本部门成为公司的最有价值部门。让自己部门为公司带来最大的利润,这比做什么都有效,别人也绝对难以动你。

    法则14:为下属着想。
    强大的部门除了有你这个强力领袖,还需要团结而强大的团队来支撑。为你的下属争取合理权益,为你的下属提供成长机会,传授知识给你的下属。记住,刻薄你的下属,始终会给你带来报应。

    法则15:做有担当的领导。
    部门出任何问题,做领导的要承担首要责任。特别是高层领导责怪下来时,你更加要一力承担,而不要将责任推诿给你的下属。如果你这样做,只会让高层领导和你的下属鄙视你。同样,如果部门作出了杰出的成绩,不要忘记你下属的功劳。

    法则16:主动杜绝冷箭。
    部门山头主义是每个公司都会有的情况,部门之间争风吃醋、互放冷箭是家常便饭的事情。
    导致这样的情况,有可能是公司架构上、部门考核方法上有战略型的错误,如果你觉得公司老板是英明的,你可以提出改善方案,说不定这是你进一步提升的机会。
    而另外一个可能,你就要千万小心了,很多公司老板喜欢搞权力制衡,喜欢搞什么“鲶鱼效应”,他就喜欢让你们各部门斗,从而刺激各部门做得更好,也防止某一部门独大,威胁到他。遇到这样的老板,你就不要“进言”了,你会明白到为什么古代很多皇帝都喜欢搞权力游戏。
    你要做的是在这样的权力游戏中生存,你有下面几个选择:
    1)你要做卑鄙小人,先下手为强,先将对手打到。
    2)练就金钟罩的功夫,防御好冷箭。
    3)敌人要放冷箭之前,主动出击!
    你不想做卑鄙小人,又不想被动挨打的话,就需要主动去杜绝冷箭,让想害你之人无法下手。
    哪天你厌倦了这样的权力游戏,就赶紧离开吧,去打造属于你自己的事业!

    你是副总!

    法则17:明白“正手”与“副手”的区别。
    不要以为做了副总,就可以飘飘然了,正职和副职区别可谓超级大。副手其实只是正职工作的延伸,正手一般会让副手干下面的事情:
    1)负责正手某一方面的工作,但重大决策必须报正职同意。
    2)坚决落实正手的某一决策,并随时向其报告情况。
    3)麻烦的、礼仪性的又不太重要的杂事。
    4)“不见得光”的事情,这点下一个法则再进一步讲解。
    副手其实没有多大的决策权的,你只有建议权。你应该在有限的空间内,再次提升自己的水平,让自己具备正手的能力。做副手一定要记住前面提到的一个重要法则“服从而且绝不越权”。

    法则18:坚决做“正手”不愿意做的事情。
    正手不愿意亲自出手的事情,一般就是:解雇、降薪之类的得罪人的工作。这样的事情,你一般不愿意主动承担,但正手大多会“主动”分派给你,你绝对不能推迟!有时候,你还需要完成不会支付赔偿的解雇工作,你不能在解雇过程中,将责任推到“正手”,你必须代表公司利益“违心”地来完成这些事情。这些事情会让你超级痛苦!哪有什么办法呢,这就当是你的人生历练吧。

    法则19:小心成为“正手”的替罪羊。
    “正手”让你吃黑锅,如果你不能扳倒他,你只能照吃不误!无论平时正手对你如何表面友好,一旦涉及到他的切身利益,什么事情都干得出来。这样的事情,平时就要警觉,尽量脱离“正手”的黑手。万一不幸要“吃死猫”,记住另外一条法则:“忍耐是一种美德”!

    最后祝愿大家在职场中乘风破浪、披荆斩棘,早日实现自己的人生价值!

     

    Posted May 10 2010, 04:38 PM by wicky with no comments
    Filed under:
  • 浅谈:国内软件公司为何无法做大做强

    http://www.cnblogs.com/saul/archive/2010/04/20/1715793.html

    纵览,国内比较大的软件公司(以下统一简称"国软"),清一色都是做政府项目的(他们能做大的原因我就不用说了吧),真正能做大的国软又有几家呢?这是为什么呢?
    今天风吹就给大家简单分析下:

     

    1."作坊"式管理
      "作坊"往往是效率最高的,国软几乎都是从作坊走过来的,
       但把作坊式的管理模式套用到一个不断壮大的公司中显然是不行的.
       组织架构到达一定程度后就必然要进行分工的细化,依靠作坊式的"暴力开发"是行不通的.

     

    2."法制社会"
       上班必须打卡,迟到要扣钱,还一次比一次多,加班没有加班费,反正算下来就是,只有扣钱的项目,没有加钱的项目.
       比起外企,人家上班不打卡,迟到不扣钱,加班有加班费,这样宽松点的环境不好吗?
     
    3.自身自灭
       国软一般没有师徒制,有的话也只是形式上的,公司基本没人管你,你也不用去管别人,
       新进的员工,不管会不会,先丢个东西给你做,自己研究,不懂的google去.
       这也是为什么国软喜欢招有经验的人,因为没经验的人熬不住,跑了几个以后,国软就不招了.

     

    4.销售-开发-维护脱节
       这点是非常严重的,会直接导致项目流产的.国软的典型的做法是,销售为了业绩,在没有调研的情况下就签了合同(这里主要是指项目型的,产品型的一般可以控制),而且合同的范围也非常模糊,可大可小,接下来就是调研人员上场,调研后发现,10w块钱的合同,调研出来了100w的需求,接下来就是和客户扯皮,最后直接导致项目流产,甚至打上官司.项目或产品上线后,维护人员对系统不了解(一方面是没有文档,另外一方面维护人员一般没有参与到开发中),接下来往往就会发生两种情况:

       a.维护人员在不了解系统的情况下擅自修改,结果导致系统越改问题越多.

       b.维护人员一不做二不休,所有客户反馈的问题全部打回给开发人员,于是开发人员就生不如死,在做别的项目的同时还要维护以前的项目,结果就是导致几个项目都失败.

     

    5.缺乏规划
       今天要用这个,明天想用那个(笔者就经历了公司在半年的时间内对框架进行了两次大的变动,导致开发人员都必须重新学习框架)
       产品也接,项目也接,大的也接,小的也接.

       今天领导说往左走,明天说往右走,也不能怪领导,他也没经验,我们就是他的DEMO.
       公司没有一个明确的目标,要做成什么样,只是一味的提出做大做强,但是没有规划出如何做大做强.(和我的标题一样哦)

     

    6.三无-无需求,无设计,无测试.
       a.没有文档是国软的通病,曾几何时,产品经理丢过来的那一句话:"喂,**,给我做一个**模块来",然后开发人员就开始埋头苦写了.
       b.当然如果你天资聪慧,可以轻易理解出产品经理的意思,那有没有设计都无所谓了,但是,当有一天别人要维护你的程序的时候问题就出现了,
       没有文档,代码又那么天马行空,怎么维护?改了这个地方,又影响了那个地方...
       c.其实程序员都懂得测试的意义,可以工时安排的那么紧,哪来的时间测试?测试又没有算工时.所以几乎所有的程序员的做法就是,直接丢给用户测试
       这时候有人肯定要问:那项目经理呢?他不是可以测试吗?请记住这是国软,刚才写代码的那个人就是项目经理,还是售前,还是设计人员,还是维护,还是...
       归结还是成本问题,在外资软件公司中,做文档的工时是比做开发的工时更多的,国软为了节省成本,这块当然要CUT掉了.不必去追去文档有多么详细多么美观,需要做的就是找到一个平衡点,一份适合自己的文档.

     

    7.员工都是"十项全能"
      在国软里面的员工各个都是十项全能(笔者就是一个鲜明的例子,从系统调研分析设计,到进度管理,开发,测试,验收,实施,维护,甚至拉给客户拉网线都需要我去.)
      直接导致的结果就是这些员工每过多久就直接出来自己开公司了...嘿嘿又一家作坊诞生了...
      这样做对员工个人其实是有好处的,但是对于企业本上来说是没有好处的,并不是说员工成立了作坊,成为了你的竞争对手,而是让员工各个都是十项全能的结果就是
      a.员工都是"十项全不能".
      b.员工一旦离职,他手头的项目必定流产.
      c.对公司的发展是不利的(细化分工).

     

    8.莫不关心
      老板并不知道员工在做什么,员工也不知道老板在做什么.
      上级很少去关心下级的工作,更别说去关心下级的生活,一个东西丢给你,一个月后交差,中间不管你任何事情,交不了差就唯你是问.
      下级也不知道能为上级分担什么,只有等着上级分配任务.
      甚至还有些老板都不不知道员工的名字,在这样的国软的,每个人都是孤立的,又怎么能做大做强呢?

     

    9.企业文化
      所谓十年树木,百年树人.
      国软的企业文化表面功夫算是做的很好的了,什么"为客户创造价值","做最好的行业解决方案","软件公司的最大资源就是人才"等等,要多华丽有多华丽,
      重复体现了"口号文化".真正做到企业文化又有多少呢?有多少仅仅是为了做给客户看的呢?

     

    10.盲目跟风
      很多国软看到人家外企软件公司最近在搞什么推进活动,就跟风,效仿外企做,可是无法领悟精髓,纯粹只是在模仿.
      (外企集体笑:"一直被模仿,从未被超越")
      做完了也不知道这么做的意义,劳民伤财.

     

    11.缺乏"执行力"
      国软的通病,就是"执行力",国软的学习劲头很足,今天提出要完善测试标准,明天提出要每周写工作报告,可是又有哪些东西能真正的去执行呢?
      导致这个问题的主要原因有两个:

      a.提出来的东西到底有没必要做,还是只是应付领导走个过场.
      b.谁来跟踪这些东西?员工写了工作报告,领导没有去查看,去反馈,员工觉得写的也没意义,自然不会继续执行下去.

     

    12.管理混乱
        没有划分清楚员工的归属组织,员工并不明确他的上级领导是谁,导致有的员工处于游离状态,有的是员工又是多个领导,不懂要听谁的,有些人忙的要死,有些人又闲的要命,最后搞的最痛苦的就是员工,导致员工离职.

     

    13.缺乏团队精神
       为什么会缺乏团队精神呢?并不是国软没有这方面的概念,国软也很希望培养员工的团队观念和精神,
       无奈因为国软,一般都是一个人负责一个或者多个项目,连团队都没有,何来的团队精神?

     

    14.无法做到补足
       一个项目一旦中途有人辞职,这个项目就会流产.
       一个员工一旦辞职,会有N个项目没人维护.
       A组的员工无法胜任B组的工作,归根结底就是组织上根本没有考虑过组织变动对项目的影响,没有提前培养人员.

     

    15.一成不变和随心所欲
       有两类人一种是把前辈的东西COPY过来,不作任何修改,因为他深信,前辈的一定是对的,
       还有一类是不管前人怎么做的,一律不要,全凭自己的"经验",随心所欲,天马行空的进行自主研发,

       造成的结果就是错的还是错的,乱的更乱了.

     

    16.人才育成
       成本,还是成本,培养一个人要多少成本?
       这就是国软做不大的原因,永远只能停留在"作坊"的原因.

     

    17.向心力.
         老板做的是事业,员工做的是事情,这是国软员工的一致观点.

     

    18.恶性循环
         a.人员力量不足 -> 接不了项目 -> 收入少 -> 人员流失.
         b.人员力量不足 -> 强行接项目 -> 亏本    -> 破产.

     

    Posted Apr 20 2010, 05:22 PM by wicky with no comments
    Filed under:
  • VS2010 Ultramate

    Ultimate Key from internet: YCFHQ9DWCYDKV88T2TMHG7BHP
    hxxp://download.microsoft.com/download/2/4/7/24733615-AA11-42E9-8883-E28CDCA88ED5/X16-42552VS2010UltimTrial1.iso

     

  • Google: Mainland China service availability

    Posted Mar 23 2010, 09:32 AM by wicky with 2 comment(s)
    Filed under:
  • ORA-27054 when using RMAN to NAS/NFS disks

    http://jhdba.wordpress.com/2008/03/04/ora-27054-when-using-rman-to-nasnfs-disks/

    Problem

    When an NFS disk is mounted there are a set of requested mount attributes. It is perfectly possible for an NFS disk to mount with the correct actual attributes (rsize/wsize etc) even if these attributes are not explicitly listed in the original mount request. However, on some platforms Oracle does not check the “actual” attributes and can think, incorrectly, that the disk is not mounted properly. Some platforms include an auto-mount feature which auto mounts the NFS disks, again with correct attributes, but Oracle cannot determine the actual mount point and attributes of the auto-mounted disk/s. As the files look like NFS type then again ORA-27054 is thrown even though the disks are mounted correctly as Oracle cannot confirm the mount attributes.

    Solution

    Use correct mount options.

    rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,vers=3,timeo=600,actimeo=0

    default rsize and wsize for NFS is 4096 Blocks

    Do not use auto-mount. Touching a file on the auto-mounted fs from your RMAN script does not wor.

    set event=”10298 trace name context forever, level 32″ in the spfile and restart the instance. The event will disable the NFS checks in 10gR2 but it will also have some side effects:

    - It will generate some trace files which you can ignore Bug:4998064 ‘Ksfq 10298 Trace Enabled For Levels Other Than Bit Level 0×2′ (unpublished)
    - It can have a side effect of disabling direct IO on RAC using regular files on NFS mounts

    This information comes from Metalink note 356199.1. I thought it worth commenting on as we have been testing RMAN network backups recently and I kept hitting the same problems as we have a sys admin who likes to use automount.

     

    Posted Mar 17 2010, 11:09 AM by wicky with no comments
    Filed under:
  • ASP.NET MVC 2 Released

    http://weblogs.asp.net/scottgu/archive/2010/03/11/asp-net-mvc-2-released.aspx

    I’m happy to announce that the final release of ASP.NET MVC 2 is now available for VS 2008/Visual Web Developer 2008 Express with ASP.NET 3.5.  You can download and install it from the following locations:

    The final release of VS 2010 and Visual Web Developer 2010 will have ASP.NET MVC 2 built-in – so you won’t need an additional install in order to use ASP.NET MVC 2 with them. 

    ASP.NET MVC 2

    We shipped ASP.NET MVC 1 a little less than a year ago.  Since then, almost 1 million developers have downloaded and used the final release, and its popularity has steadily grown month over month.

    ASP.NET MVC 2 is the next significant update of ASP.NET MVC. It is a compatible update to ASP.NET MVC 1 – so all the knowledge, skills, code, and extensions you already have with ASP.NET MVC continue to work and apply going forward. Like the first release, we are also shipping the source code for ASP.NET MVC 2 under an OSI-compliant open-source license.

    ASP.NET MVC 2 can be installed side-by-side with ASP.NET MVC 1 (meaning you can have some apps built with V1 and others built with V2 on the same machine).  We have instructions on how to update your existing ASP.NET MVC 1 apps to use ASP.NET MVC 2 using VS 2008 here.  Note that VS 2010 has an automated upgrade wizard that can automatically migrate your existing ASP.NET MVC 1 applications to ASP.NET MVC 2 for you.

    ASP.NET MVC 2 Features

    ASP.NET MVC 2 adds a bunch of new capabilities and features.  I’ve started a blog series about some of the new features, and will be covering them in more depth in the weeks ahead.  Some of the new features and capabilities include:

     

     

    You can learn more about these features in the “What’s New in ASP.NET MVC 2” document on the www.asp.net/mvc web-site. 

    We are going to be posting a lot of new tutorials and videos shortly on www.asp.net/mvc that cover all the features in ASP.NET MVC 2 release.  We will also post an updated end-to-end tutorial built entirely with ASP.NET MVC 2 (much like the NerdDinner tutorial that I wrote that covers ASP.NET MVC 1). 

    Summary

    The ASP.NET MVC team delivered regular V2 preview releases over the last year to get feedback on the feature set.  I’d like to say a big thank you to everyone who tried out the previews and sent us suggestions/feedback/bug reports. 

    We hope you like the final release!

    Scott

    Posted Mar 15 2010, 08:58 AM by wicky with no comments
    Filed under:
  • ASP.NET的Session会导致的性能问题

    http://www.cnblogs.com/sumtec/archive/2009/07/10/1520216.html

    你的站点有被客户投诉很慢吗?是不是查了很多遍还是没有完全解决?是不是数据库没有发现异常,CPU也没有异常,内存占用量没有异常,GC计数没有异常,硬盘IO也没有异常,带宽没有异常,线路没有异常,没有丢包,但就是被投诉?而且还是阵发性的,有某个用户投诉慢的时候,你访问却很快,本地又复现不出来?今天你访问了博客园真是太幸运了,也许这里就有你想要的一个答案——假如你的站点动态处理了图片或者其他原本不会动态处理的非网页资源的话。没想到吧,这是Session惹的祸!

    我们公司某个站点访问量一直很大,几年前就已经发现客户经常投诉说很慢,而这个问题我们一直都在排查和解决。从线路问题,到数据库连接泄露,到数据库死锁、索引,以及程序的优化问题,我们都查找过,并且解决过。然而,这个问题总还是存在。比如说,在IIS日志中,就会经常看到time-taken大于10秒钟的访问。而最近我们的KPI要求解决这个问题,不得已,再次踏上这趟艰难的排查之旅。

    之所以说艰难,是因为这个现象在本地几乎无法复现,一个是这个现象是阵发性的,第二个是本地访问量或者数据量不够大。我们也尝试过在本地加载线上服务器的数据库,然后拿服务器的IIS的Log文件重播,结果确实是偶尔发现IIS日志中的time-taken也会比较长,但是本地服务器性能不如线上服务器的,比如说IO就差很远,于是总说不清楚到底是什么问题。而线上服务器也不方便用做Dump的形式查找:第一是因为线上一做Dump,站点就会在几分钟内失去响应,这样我们客服的电话就会被打爆;另一个原因还是阵发性的问题,我们不可能一直盯着性能看,然后在发生问题的瞬间做Dump。再说了,看性能也看不出来,因为那些响应时间很长的访问,其前后附近的响应都特别的快。不可避免的,我们只能够在代码里面塞入一些调试和日志的代码,以期望能够得到一些有用的信息。

    最开始的时候,我们认为最可能的原因是数据库阻塞,比如正好某一个访问锁住某个数据库对象(比如一张表或者某几行),如果这个时候访问特定的页面,可能就会比较慢。于是在数据库层塞入了一堆代码,这些代码会在数据库连接数量多,或者某个数据库连接时间特别长的时候,将所有数据库连接的当前访问语句、连接持续总时间,以及这些连接当前的堆栈情况都输出到文件中。与此同时,我们还打开Sql profiler对这个数据库进行监视,将持续时间超过1秒钟的都记录下来。然而跑了一天之后,却发现什么都没有被记录下来,但IIS日志中仍然在这段时间内出现许多10秒以上的访问。这个时候,我们就意识到,可能方向错了。

    接着,我们就开始塞另外一段代码:一个IHttpModule。这个模块就只是截获每一个页面访问的完整生命周期中的所有事件,比如BeginRequest、PreAuthenticateRequest等。同时在BeginRequest开始的时候设置一个定时器,每隔一秒钟就会出发一个事件,来记录本次访问过程中,本模块收集到的所有线程中当前的堆栈情况。最后,在EndRequest的时候,如果访问时间超过5秒,就将之前截获的所有信息输出到文件中。这一下子问题就变得非常的清晰了,比如说,下面这种输出(片断)就是非常典型的一个情况:

    #Steps:
    #Fields: date time threadId stepName
    #---------------------------------------------------
    2009-07-09 16:48:01.752 0024 BeginRequest
    2009-07-09 16:48:01.752 0024 AuthenticateRequest
    2009-07-09 16:48:01.752 0024 PostAuthenticateRequest
    2009-07-09 16:48:01.752 0024 AuthorizeRequest
    2009-07-09 16:48:01.752 0024 PostAuthorizeRequest
    2009-07-09 16:48:01.752 0024 ResolveRequestCache
    2009-07-09 16:48:01.752 0024 PostResolveRequestCache
    2009-07-09 16:48:01.752 0024 PostMapRequestHandler
    2009-07-09 16:48:06.284 0007 AcquireRequestState
    2009-07-09 16:48:06.284 0007 PostAcquireRequestState
    2009-07-09 16:48:06.284 0007 PreRequestHandlerExecute
    2009-07-09 16:48:06.284 0007 EndRequest
    #---------------------------------------------------
    #End of steps.

    也就是说,在PostMapRequestHandler之后,AcquireRequestState之前,有一大段的等待时间。而这个报告后面的堆栈情况,则显得很奇怪:线程7从第一次截快照的时候开始,一直到结束都是空白的!甚至在其他的一些报告中甚至会发现这个线程已经被分派处理其他页面的工作了(堆栈中的调用很明显指出是另一个aspx页面的代码)。结果一Google“PostMapRequestHandler”和“AcquireRequestState”这两个关键字,就找到了国外另一个有类似遭遇的受害者:

    http://forums.iis.net/t/1147300.aspx

    这个楼主是一个aspx页面里面有好几个iframe,并且每一个iframe里面都是访问同一个Web应用下的Aspx页面。现象就是iframe内的页面会一个个蹦出来,尤其是这些页面都比较慢的时候。和我这里截获到的情况一样,也是PostMapRequestHandler事件到AcquireRequestState之间有很长的空白时间。顺藤摸瓜,又找到了这么一个帖子:

    http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.dotnet.framework.aspnet&mid=7f56033f-caac-47c2-bd9c-95512aa14b47

    原来,在AcquireRequestState之前,需要等待上一个同SessionId的页面处理完毕之后,才会继续处理当前页面。其根本原因是:同一个SessionId下面的Session对象不应该被同时写入,否则就会全乱套了,原理和多线程竞争是一样的。因此在设计上,同一个SessionId的页面(或者IHttpHandler)就会顺序执行。

    好了,到这里真相又一次大白了!(指不定还有别的问题,还会有下一次大白的时候)在我们的系统中,由于特殊的原因,对图片的输出我们会通过Asp.Net来处理,比如说加上一些合适的缓存标记,甚至会动态生成图片输出(令人惊讶的是,这个动态输出的总时间消耗甚至不到100毫秒,所以不要说动态生成是一种不好的实施方式)。但是,由于没有经过特殊处理,Asp.Net底层认为这些访问时需要对Session进行写操作的,于是就在AcquireRequestState之前挂起,等待上一次同SessionId访问结束。可想而知,图片多了就会导致排队,甚至排很长的队。如果在排队结束之前访问下一个页面,正好系统又没有丢掉之前的队列,则这次访问就会变得比较漫长了。那么怎么做呢? 在一次顺藤摸瓜,找到了确切的说法:

    http://msdn.microsoft.com/en-us/library/ms178581.aspx

    注意下面的这段话:

    Concurrent Requests and Session State

    Access to ASP.NET session state is exclusive per session, which means that if two different users make concurrent requests, access to each separate session is granted concurrently. However, if two concurrent requests are made for the same session (by using the same SessionID value), the first request gets exclusive access to the session information. The second request executes only after the first request is finished. (The second session can also get access if the exclusive lock on the information is freed because the first request exceeds the lock time-out.) If theEnableSessionState value in the @ Page directive is set to ReadOnly, a request for the read-only session information does not result in an exclusive lock on the session data. However, read-only requests for session data might still have to wait for a lock set by a read-write request for session data to clear.

     也就是说,对于页面,我们可以简单的在Aspx上的<% @Page %>内设置EnableSessionState=”false”,或者EnableSessionState=”ReadOnly”,就可以减轻这种问题的症状。前一种设置将会禁止对Session的访问,而后一种设置则只能允许只读访问(你不能够对Session进行写操作)。正好,我们刚才提到的IHttpHandler中,对图片进行处理的部分,是不需要对Session进行写操作的,但是却需要读取Session(根据状态不同,而需要获取一些特殊信息),因此可以采取上述的措施来解决问题。

    上述参考文献中,并没有说明如何对不是Page的IHttpHandler如何设置,这里我特别说明一下。对于自定义的一个实现了IHttpHandler接口的类,只要同时实现IReadOnlySessionState,即可达到EnableSessionState="ReadOnly"的效果。同时,如果没有实现IRequiresSessionState,则等价于EnableSessionState=”false”的效果。

    注意:本文所说的,不是说你在代码里面有没有用到Session,Asp.Net不会扫描你的代码看看有没有访问Session,或者在你第一次访问Session的时候才会加锁。Asp.Net是在AcquireRequestState事件之前就首先申请这个锁——只要你的页面没有设置EnableSessionState=”false”或EnableSessionState=”ReadOnly”,或者你的IHttpHandler实现了IRequiresSessionState却没有实现IReadOnlySessionState接口就会这样。回复中有很多同学说“只要我不用Session不就行了吗?”或者“我从来不用Session”,这么想完全是错误的,只能说你没有理解这背后的机制,甚至可能连Asp.net生命周期都不太清楚。Asp.Net之所以在你的页面代码开始执行之前就锁定,是要保证整个环境的完整性,避免部分执行的情况。当然,也正如上面的一些引用中所提到的,你可以自己写一个SessionProvider而不做任何的锁工作,但这样做肯定有不确定性的风险,到时候只能你自己承担,并且更难复现和调试。

    后记:

    可能有不少人都知道Session是什么,也有很多人知道Asp.net的生命周期都包含哪些,比如一搜索"PostMapRequestHandler AcquireRequestState",就会出来很多中文的页面介绍HttpApplication类都有哪些事件,以及生命周期等等。而说到Session会造成特殊情况下站点性能问题的,似乎中文界我这还真是第一篇。当然了,这个问题可能比较偏,因为一般大家都只会处理Aspx页面而不会处理图片,甚至用Aspx页面来动态输出图片的机会都比较少,英文的似乎也只有文中提到的唯一一个同志提出来了。

    不过,有一个很常见的场景会受这个问题的影响,那就是“验证码”。如果验证码生成速度很慢,同时客户端浏览器选择长连接而服务器也接受长连接,则可能会影响在输出验证码完毕之前访问下一个页面的速度。反过来,我们也经常可以体验到,验证码出来的速度总是特别慢,总是“蹦”出来的,尤其是当前页面特别复杂的时候,似乎页面没有加载完就总不会出现验证码。估计我说的问题就是原因之一。

    不过验证码的问题还不是特别好解决,因为为了避免信息泄露的问题,验证码的答案通常是存在在Session里面的,而通常的设计也是一访问验证码图片,就会将验证码答案写到Session里面。所以,很不幸,文中提到的那个解决办法是行不通的,至少不是能够直接行得通的。这个问题有没有救药?有,当然有了。怎么救?哈,那就有劳你自己开动脑筋了,我这里算是点到即止了。

    Posted Feb 05 2010, 08:47 AM by wicky with no comments
    Filed under:
  • Unable to Disable Integrity Checks Cause Drivers Not Found in 64-bit Vista (x64)

    http://www.mydigitallife.info/2008/02/26/unable-to-disable-integrity-checks-cause-drivers-not-found-in-64-bit-vista-x64/

    Many Windows Vista users install non-certified or non-signed drivers on 64bit (x64) edition of Vista, which features Kernel Patch Protection that prevents unauthorized patch or change to the key resources used by the kernel or kernel code itself and its data structures from been modified. The workaround to run unsigned and uncertified drivers in 64-bit Vista is by using the following command:

    bcdedit /set loadoptions DDISABLE_INTEGRITY_CHECKS
    bcdedit -set loadoptions \”DDISABLE_INTEGRITY_CHECK”
    bcdedit -set loadoptions \DDISABLE_INTEGRITY_CHECKS”
    bcdedit.exe -set loadoptions DDISABLE_INTEGRITY_CHECKS
    Bcdedit.exe /set nointegritychecks ON

    However, when user attempts to run the above command to disable integrity checks on the loading drivers, the following error message appears:

    An error occurred while attempting to reference the specified entry.
    The system cannot find the file specified.

    And if you manage to apply setting above previously on load options, but suddenly, there are errors and problems related to rejected or unacceptable drivers or services. Vista simply does not accept any unsigned drivers or processes, causing old drivers or software processes that haven’t been updated cannot be found and installed in Vista x64. The issue is known to affect PeerGuardian, TV tuner cards, Gigabit Ethernet adapters, CD/DVD-ROM/RW drives, and many other devices. Although the devices are listed and shown in Device Manager in System Properties, but they’re not working due to the unsigned driver issue. It also affects and fails any modified system files such as patched tcpip.sys to unlock network speed potential.

    In System Event Log, there may be also log message saying something like: “Windows cannot verify the digital signature for this file. A recent hardware or software change might have installed a file that is signed incorrectly or damaged, or that might be malicious software from an unknown source.”

    The problem occurs because Microsoft has decided to disable DDISABLE_INTEGRITY_CHECKS support in updated x64 Vista, which mean users cannot disable the integrity checks anymore. Microsoft is reportedly rolled out the change various updates including KB932596, KB938979, KB938194 and KB941649 hotfixes, and probably Windows Vista Service Pack 1.

    The updates also remove the effectiveness of ignoring code signing for drivers in Group Policy. Previously, users can run “gpedit.msc” and navigate to User Configuration -> Administrative Templates -> System -> Driver Installation, and then enable the “Code signing for drivers” and set the option to “Ignore”. This option also no longer works.

    There are a few possible resolution or workaround to re-enable the ability to disable integrity checks and have DDISABLE_INTEGRITY_CHECKS option enabled so that it’s possible to load uncertified drivers or executables, such as suggestions below.

    1. Uninstall KB932596, KB938979, KB938194 and KB941649 updates from “Installed Updates” in “Programs and Features”, and never install them again. Best still, hide the updates from viewing and accidental install in Windows Update. After uninstalling and rebooting the computer, add the DDISABLE_INTEGRITY_CHECKS option and restart to disable integrity checks again. This method probably won’t work with the release of SP1, which incorporated all these changes.
    2. Press F8 key upon initial system boot up, and then choose to disable forced driver signing enforcement for that boot session. However, users have to apply this option every shutdown and restart. An easy solution to the hassle is put computer into sleep or hibernate mode instead of shutting down everytime.
    3. Use ReadyDriver Plus to permanently disable and turn off disable driver signing enforcement automatically on every system startup.
    4. Sign the driver with test certificate, which is supplied with Software Development Kit (SDK) for Windows Vista and .NET Framework 3.0 Runtime Components, and then turn of test signing mode in Vista x64 by suing “bcdedit.exe /set TESTSIGNING ON” command. This trick will need computer running consistently in testing mode, which meant for developers to try out drivers signed with self-signed or test certificate. Risk for running computer in test signing mode is unknown, and there will be “Test Mode” watermarks been labeled on four corner of desktop, although the 64-bit watermark can also be removed.

     

    Posted Jan 23 2010, 10:40 AM by wicky with no comments
    Filed under:
  • Driver Signature Enforcement Overrider 1.3b

    http://www.ngohq.com/home.php?page=dseo

    It seems that Microsoft has forgotten end users when it introduced a very restricted module of driver signature enforcement in Windows Vista and Windows 7. All drivers and system files must be digitally verified or they cannot run when using both 32-bit and 64-bit versions of Windows Vista and Windows 7. In the past, it was possible to turn that feature off in Vista, but due to new kernel security updates, it is impossible to turn it off without degrading security and stability of your operating system or putting your master boot records in risk by using other software alternatives.

    So what is the problem with digital certificates? Well, the problem is… developers have to pay Microsoft to receive verified certificates, and that makes many applications inaccessible under Windows Vista and Windows 7. However, it is still possible to turn it off by pressing the F8 function key during system boot up, but pressing F8 every time on boot up can be a serious pain in the butt. Others have found workarounds, but most of them are too risky and may trash your master boot records, at least until now thanks to our latest tool.

    How does it work?
    Microsoft is aware that developers cannot submit every beta build they are testing. Microsoft has provided a mode inside Windows Vista and Windows 7 that will allow developers to test their software before they submit it to Microsoft’s labs. Unfortunately, even in that test mode drivers and system files must have a test certificate before installation.

    The good thing is that it does not have to be digitally verified. That means we can load drivers by creating our own unverified certificates. Do not worry! You do not have to do anything; our Driver Signature Enforcement Overrider will do everything for you.

    False Positive Alert
    It has come to our attention that several Antivirus suites have listed our Driver Signature Enforcement Overrider (DSEO) as a dangerous file. That's nonsense! DSEO is safe. These Antivirus suites are being used as a tool to remove software that Microsoft deems contrary to its outlook, instead of protecting the customer from dangerous files. Read more about it here.

    Supported OSes
    * Windows Vista 32-bit
    * Windows Vista 64-bit
    * Windows Server 2008 32-bit
    * Windows Server 2008 64-bit
    * Windows 7 32-bit
    * Windows 7 64-bit

    Changes
    * Watermarks Removal Option
    * Support for Windows 7
    * Several Bug-fixes

    So how do I use it?
    First and foremost; you are using this software at your own risk, we do not take responsibility for any damages to your system, but we do not believe it can harm anyone anyway. Secondly, User Account Control (UAC) must be disabled in-order to use this tool as well.

    1. Go ahead download and launch the application from the link below. Inside its main menu, press on the “Enable Test Mode” button and follow the instructions on the screen. This will enable TESTSIGNING mode, which allows unverified system files to be loaded.

    2. Now all you have to do is to add the unverified signature to the required system files. To do so press on the “Sign a System File” button from the main menu, and enter specific filename including full path. For example: if ATITool64.sys from C:\Windows\System32\drivers refuses to load due to driver signature enforcement, you should type: “C:\Windows\System32\drivers\ATITool64.sys”, and if you would like to sign more than a single file, just repeat this procedure until you’re done, and finally reboot.

    After you enabled Test Mode and added signatures to the required system files, they should bypass Windows’s driver signature enforcement and load without any issues. However, if for some reason you are interested to revert it, you can re-launch the application, choose “Disable Test Mode” from the main menu, and reboot. If you encounter issues or having questions, feel free to post it on our forums.

    Note: User Account Control (UAC) must be disabled in-order to use this tool.
    Download

    Posted Jan 23 2010, 10:38 AM by wicky with no comments
    Filed under:
  • Outlook Express 6 (OE6) for Win7

    Outlook Express 6 (OE6) for Win7

    Outlook Express 6 (OE6) for Windows Vista,Windows 7,Windows 2008,Windows 2008 R2
     
    If you have tried Outlook 2010/2007/2003, Windows Mail, Windows Live Mail, Thunderbird, Becky, The Bat, Foxmail, Dream Mail ..., and still love Outlook Express 6, and still think it's your favorite email client, then this is the solution for you.
     
    HOW IT WORKS:
    The reason that OE6 cannot run in Vista or newer system, is Microsoft make some OE6 core DLLs incompatible, something called "DLL HELL".
    Mainly these files: inetcomm.dll, msoert2.dll, msoeacct.dll, directdb.dll.
    However, we cannot simply replace the system DLLs because that may make system or some applications stop working.
    So the trick is to let OE6 load old DLLs in current directory when running, and leave system DLLs untouched, then everything should be ok.
    The way to let this happen is to hijack NtQueryValueKey in ntdll.dll, then change the return Path to current directory if needed.
    Microsoft provide a free tool to do this kind of job, so we just use it: Detours.
     
    HOW TO USE:
    1. extract the zip file to a directory
    2. run setup.bat as administrator
    3. if you want to save password, you need to replace Protected Storage service with writable version:
    4. start msimn.exe
     
    DOWNLOAD:
     
    HISTORY:
    Version 0.1:  first release
    Posted Jan 21 2010, 08:37 AM by wicky with no comments
    Filed under:
  • BASE64编码作为QueryString时要注意的问题

        加号(+)是BASE64编码的一部分,而加号在QueryString中被当成是空格。
        因此,当一个含有BASE64编码的字符串直接作为URL的一部分时,如果其中含有加号,则使用QueryString读取时,再使用BASE64解码就会发生错误。

        解决的办法有两个:
    一是使用BASE64的字符串作为URL的一部分是,使用UrlEncode一类的函数进行编码;
    二是在接收BASE64字符串后,使用Replace将字符串中的空格替换成加号,然后再解码。

    Posted Jan 19 2010, 08:53 AM by wicky with no comments
    Filed under:
  • 如何解决TIME_WAIT过多的解决办法

    linux和windows下TIME_WAIT过多的解决办法

    如果使用了nginx代理,那么系统TIME_WAIT的数量会变得比较多,这是由于nginx代理使用了短链接的方式和后端交互的原因,使得nginx和后端的ESTABLISHED变得很少而TIME_WAIT很多。这不但发生在安装nginx的代理服务器上,而且也会使后端的app服务器上有大量的TIME_WAIT。查阅TIME_WAIT资料,发现这个状态很多也没什么大问题,但可能因为它占用了系统过多的端口,导致后续的请求无法获取端口而造成障碍。

    虽然TIME_WAIT会造成一些问题,但是要完全枪毙掉它也是不正当的,虽然看起来这么做没什么错。具体可看这篇文档:

    http://hi.baidu.com/tim_bi/blog/item/35b005d784ca91d5a044df1d.html

    所以目前看来最好的办法是让每个TIME_WAIT早点过期。

    在linux上可以这么配置:

    #让TIME_WAIT状态可以重用,这样即使TIME_WAIT占满了所有端口,也不会拒绝新的请求造成障碍
    echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse
    #让TIME_WAIT尽快回收,我也不知是多久,观察大概是一秒钟
    echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle

    很多文档都会建议两个参数都配置上,但是我发现只用修改tcp_tw_recycle就可以解决问题的了,TIME_WAIT重用TCP协议本身就是不建议打开的。

    不能重用端口可能会造成系统的某些服务无法启动,比如要重启一个系统监控的软件,它用了40000端口,而这个端口在软件重启过程中刚好被使用了,就可能会重启失败的。linux默认考虑到了这个问题,有这么个设定:

    #查看系统本地可用端口极限值
    cat /proc/sys/net/ipv4/ip_local_port_range

    用这条命令会返回两个数字,默认是:32768 61000,说明这台机器本地能向外连接61000-32768=28232个连接,注意是本地向外连接,不是这台机器的所有连接,不会影响这台机器的80端口的对外连接数。但这个数字会影响到代理服务器(nginx)对app服务器的最大连接数,因为nginx对app是用的异步传输,所以这个环节的连接速度很快,所以堆积的连接就很少。假如nginx对app服务器之间的带宽出了问题或是app服务器有问题,那么可能使连接堆积起来,这时可以通过设定nginx的代理超时时间,来使连接尽快释放掉,一般来说极少能用到28232个连接。

    因为有软件使用了40000端口监听,常常出错的话,可以通过设定ip_local_port_range的最小值来解决:

    echo "40001 61000" > /proc/sys/net/ipv4/ip_local_port_range

    但是这么做很显然把系统可用端口数减少了,这时可以把ip_local_port_range的最大值往上调,但是好习惯是使用不超过32768的端口来侦听服务,另外也不必要去修改ip_local_port_range数值成1024 65535之类的,意义不大。

    因为使用了nginx代理,在windows下也会造成大量TIME_WAIT,当然windows也可以调整:

    在注册表(regedit)的HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters上添加一个DWORD类型的值TcpTimedWaitDelay,值就是秒数,即可。

    windows默认是重用TIME_WAIT,我现在还不知道怎么改成不重用的,本地端口也没查到是什么值,但这些都关系不大,都可以按系统默认运作。

    ------------------------------------------------------------------------------------------------------------------------

    TIME_WAIT状态

    根据TCP协议,主动发起关闭的一方,会进入TIME_WAIT状态,持续2*MSL(Max Segment Lifetime),缺省为240秒,在这个post中简洁的介绍了为什么需要这个状态。

    值得一说的是,对于基于TCP的HTTP协议,关闭TCP连接的是Server端,这样,Server端会进入TIME_WAIT状态,可想而知,对于访问量大的Web Server,会存在大量的TIME_WAIT状态,假如server一秒钟接收1000个请求,那么就会积压240*1000=240,000个TIME_WAIT的记录,维护这些状态给Server带来负担。当然现代操作系统都会用快速的查找算法来管理这些TIME_WAIT,所以对于新的TCP连接请求,判断是否hit中一个TIME_WAIT不会太费时间,但是有这么多状态要维护总是不好。

    HTTP协议1.1版规定default行为是Keep-Alive,也就是会重用TCP连接传输多个request/response,一个主要原因就是发现了这个问题。还有一个方法减缓TIME_WAIT压力就是把系统的2*MSL时间减少,因为240秒的时间实在是忒长了点,对于Windows,修改注册表,在HKEY_LOCAL_MACHINE\ SYSTEM\CurrentControlSet\Services\ Tcpip\Parameters上添加一个DWORD类型的值TcpTimedWaitDelay,一般认为不要少于60,不然可能会有麻烦。

    对于大型的服务,一台server搞不定,需要一个LB(Load Balancer)把流量分配到若干后端服务器上,如果这个LB是以NAT方式工作的话,可能会带来问题。假如所有从LB到后端Server的IP包的source address都是一样的(LB的对内地址),那么LB到后端Server的TCP连接会受限制,因为频繁的TCP连接建立和关闭,会在server上留下TIME_WAIT状态,而且这些状态对应的remote address都是LB的,LB的source port撑死也就60000多个(2^16=65536,1~1023是保留端口,还有一些其他端口缺省也不会用),每个LB上的端口一旦进入Server的TIME_WAIT黑名单,就有240秒不能再用来建立和Server的连接,这样LB和Server最多也就能支持300个左右的连接。如果没有LB,不会有这个问题,因为这样server看到的remote address是internet上广阔无垠的集合,对每个address,60000多个port实在是够用了。

    一开始我觉得用上LB会很大程度上限制TCP的连接数,但是实验表明没这回事,LB后面的一台Windows Server 2003每秒处理请求数照样达到了600个,难道TIME_WAIT状态没起作用?用Net Monitor和netstat观察后发现,Server和LB的XXXX端口之间的连接进入TIME_WAIT状态后,再来一个LB的XXXX端口的SYN包,Server照样接收处理了,而是想像的那样被drop掉了。翻书,从书堆里面找出覆满尘土的大学时代买的《UNIX Network Programming, Volume 1, Second Edition: Networking APIs: Sockets and XTI》,中间提到一句,对于BSD-derived实现,只要SYN的sequence number比上一次关闭时的最大sequence number还要大,那么TIME_WAIT状态一样接受这个SYN,难不成Windows也算BSD-derived?有了这点线索和关键字(BSD),找到这个post,在NT4.0的时候,还是和BSD-derived不一样的,不过Windows Server 2003已经是NT5.2了,也许有点差别了。

    做个试验,用Socket API编一个Client端,每次都Bind到本地一个端口比如2345,重复的建立TCP连接往一个Server发送Keep-Alive=false的HTTP请求,Windows的实现让sequence number不断的增长,所以虽然Server对于Client的2345端口连接保持TIME_WAIT状态,但是总是能够接受新的请求,不会拒绝。那如果SYN的Sequence Number变小会怎么样呢?同样用Socket API,不过这次用Raw IP,发送一个小sequence number的SYN包过去,Net Monitor里面看到,这个SYN被Server接收后如泥牛如海,一点反应没有,被drop掉了。

    按照书上的说法,BSD-derived和Windows Server 2003的做法有安全隐患,不过至少这样至少不会出现TIME_WAIT阻止TCP请求的问题,当然,客户端要配合,保证不同TCP连接的sequence number要上涨不要下降。

    ----------------------------------------------------------------------------------------------------------------------------

    Socket中的TIME_WAIT状态

    在高并发短连接的server端,当server处理完client的请求后立刻closesocket此时会出现time_wait状态然后如果client再并发2000个连接,此时部分连接就连接不上了,用linger强制关闭可以解决此问题,但是linger会导致数据丢失,linger值为0时是强制关闭,无论并发多少多能正常连接上,如果非0会发生部分连接不上的情况!(可调用setsockopt设置套接字的linger延时标志,同时将延时时间设置为0。
    TCP/IP的RFC文档。TIME_WAIT是TCP连接断开时必定会出现的状态。
    是无法避免掉的,这是TCP协议实现的一部分。
    在WINDOWS下,可以修改注册表让这个时间变短一些

    time_wait的时间为2msl,默认为4min.
    你可以通过改变这个变量:
    TcpTimedWaitDelay
    把它缩短到30s
    TCP要保证在所有可能的情况下使得所有的数据都能够被投递。当你关闭一个socket时,主动关闭一端的socket将进入TIME_WAIT状态,而被动关闭一方则转入CLOSED状态,这的确能够保证所有的数据都被传输。当一个socket关闭的时候,是通过两端互发信息的四次握手过程完成的,当一端调用close()时,就说明本端没有数据再要发送了。这好似看来在握手完成以后,socket就都应该处于关闭CLOSED状态了。但这有两个问题,首先,我们没有任何机制保证最后的一个ACK能够正常传输,第二,网络上仍然有可能有残余的数据包(wandering duplicates),我们也必须能够正常处理。
    通过正确的状态机,我们知道双方的关闭过程如下

    假设最后一个ACK丢失了,服务器会重发它发送的最后一个FIN,所以客户端必须维持一个状态信息,以便能够重发ACK;如果不维持这种状态,客户端在接收到FIN后将会响应一个RST,服务器端接收到RST后会认为这是一个错误。如果TCP协议能够正常完成必要的操作而终止双方的数据流传输,就必须完全正确的传输四次握手的四个节,不能有任何的丢失。这就是为什么socket在关闭后,仍然处于 TIME_WAIT状态,因为他要等待以便重发ACK。

    如果目前连接的通信双方都已经调用了close(),假定双方都到达CLOSED状态,而没有TIME_WAIT状态时,就会出现如下的情况。现在有一个新的连接被建立起来,使用的IP地址与端口与先前的完全相同,后建立的连接又称作是原先连接的一个化身。还假定原先的连接中有数据报残存于网络之中,这样新的连接收到的数据报中有可能是先前连接的数据报。为了防止这一点,TCP不允许从处于TIME_WAIT状态的socket建立一个连接。处于TIME_WAIT状态的socket在等待两倍的MSL时间以后(之所以是两倍的MSL,是由于MSL是一个数据报在网络中单向发出到认定丢失的时间,一个数据报有可能在发送图中或是其响应过程中成为残余数据报,确认一个数据报及其响应的丢弃的需要两倍的MSL),将会转变为CLOSED状态。这就意味着,一个成功建立的连接,必然使得先前网络中残余的数据报都丢失了。

    由于TIME_WAIT状态所带来的相关问题,我们可以通过设置SO_LINGER标志来避免socket进入TIME_WAIT状态,这可以通过发送RST而取代正常的TCP四次握手的终止方式。但这并不是一个很好的主意,TIME_WAIT对于我们来说往往是有利的。

     

     

    客户端与服务器端建立TCP/IP连接后关闭SOCKET后,服务器端连接的端口
    状态为TIME_WAIT
    是不是所有执行主动关闭的socket都会进入TIME_WAIT状态呢?
    有没有什么情况使主动关闭的socket直接进入CLOSED状态呢?
    主动关闭的一方在发送最后一个 ack 后
    就会进入 TIME_WAIT 状态 停留2MSL(max segment lifetime)时间
    这个是TCP/IP必不可少的,也就是“解决”不了的。

    也就是TCP/IP设计者本来是这么设计的
    主要有两个原因
    1。防止上一次连接中的包,迷路后重新出现,影响新连接
       (经过2MSL,上一次连接中所有的重复包都会消失)
    2。可靠的关闭TCP连接
       在主动关闭方发送的最后一个 ack(fin) ,有可能丢失,这时被动方会重新发
       fin, 如果这时主动方处于 CLOSED 状态 ,就会响应 rst 而不是 ack。所以
       主动方要处于 TIME_WAIT 状态,而不能是 CLOSED 。

    TIME_WAIT 并不会占用很大资源的,除非受到攻击。

    还有,如果一方 send 或 recv 超时,就会直接进入 CLOSED 状态

     

    socket-faq中的这一段讲的也很好,摘录如下:
    2.7. Please explain the TIME_WAIT state.

    Remember that TCP guarantees all data transmitted will be delivered,
    if at all possible. When you close a socket, the server goes into a
    TIME_WAIT state, just to be really really sure that all the data has
    gone through. When a socket is closed, both sides agree by sending
    messages to each other that they will send no more data. This, it
    seemed to me was good enough, and after the handshaking is done, the
    socket should be closed. The problem is two-fold. First, there is no
    way to be sure that the last ack was communicated successfully.
    Second, there may be "wandering duplicates" left on the net that must
    be dealt with if they are delivered.

    Andrew Gierth (andrew@erlenstar.demon.co.uk) helped to explain the
    closing sequence in the following usenet posting:

    Assume that a connection is in ESTABLISHED state, and the client is
    about to do an orderly release. The client's sequence no. is Sc, and
    the server's is Ss. Client Server
    ====== ======
    ESTABLISHED ESTABLISHED
    (client closes)
    ESTABLISHED ESTABLISHED
    ------->>
    FIN_WAIT_1
    <<--------
    FIN_WAIT_2 CLOSE_WAIT
    <<-------- (server closes)
    LAST_ACK
    , ------->>
    TIME_WAIT CLOSED
    (2*msl elapses...)
    CLOSED

    Note: the +1 on the sequence numbers is because the FIN counts as one
    byte of data. (The above diagram is equivalent to fig. 13 from RFC
    793).

    Now consider what happens if the last of those packets is dropped in
    the network. The client has done with the connection; it has no more
    data or control info to send, and never will have. But the server does
    not know whether the client received all the data correctly; that's
    what the last ACK segment is for. Now the server may or may not care
    whether the client got the data, but that is not an issue for TCP; TCP
    is a reliable rotocol, and must distinguish between an orderly
    connection close where all data is transferred, and a connection abort
    where data may or may not have been lost.

    So, if that last packet is dropped, the server will retransmit it (it
    is, after all, an unacknowledged segment) and will expect to see a
    suitable ACK segment in reply. If the client went straight to CLOSED,
    the only possible response to that retransmit would be a RST, which
    would indicate to the server that data had been lost, when in fact it
    had not been.

    (Bear in mind that the server's FIN segment may, additionally, contain
    data.)

    DISCLAIMER: This is my interpretation of the RFCs (I have read all the
    TCP-related ones I could find), but I have not attempted to examine
    implementation source code or trace actual connections in order to
    verify it. I am satisfied that the logic is correct, though.

    More commentarty from Vic:

    The second issue was addressed by Richard Stevens (rstevens@noao.edu,
    author of "Unix Network Programming", see ``1.5 Where can I get source
    code for the book [book title]?''). I have put together quotes from
    some of his postings and email which explain this. I have brought
    together paragraphs from different postings, and have made as few
    changes as possible.

    From Richard Stevens (rstevens@noao.edu):

    If the duration of the TIME_WAIT state were just to handle TCP's full-
    duplex close, then the time would be much smaller, and it would be
    some function of the current RTO (retransmission timeout), not the MSL
    (the packet lifetime).

    A couple of points about the TIME_WAIT state.

    o The end that sends the first FIN goes into the TIME_WAIT state,
    because that is the end that sends the final ACK. If the other
    end's FIN is lost, or if the final ACK is lost, having the end that
    sends the first FIN maintain state about the connection guarantees
    that it has enough information to retransmit the final ACK.

    o Realize that TCP sequence numbers wrap around after 2**32 bytes
    have been transferred. Assume a connection between A.1500 (host A,
    port 1500) and B.2000. During the connection one segment is lost
    and retransmitted. But the segment is not really lost, it is held
    by some intermediate router and then re-injected into the network.
    (This is called a "wandering duplicate".) But in the time between
    the packet being lost & retransmitted, and then reappearing, the
    connection is closed (without any problems) and then another
    connection is established between the same host, same port (that
    is, A.1500 and B.2000; this is called another "incarnation" of the
    connection). But the sequence numbers chosen for the new
    incarnation just happen to overlap with the sequence number of the
    wandering duplicate that is about to reappear. (This is indeed
    possible, given the way sequence numbers are chosen for TCP
    connections.) Bingo, you are about to deliver the data from the
    wandering duplicate (the previous incarnation of the connection) to
    the new incarnation of the connection. To avoid this, you do not
    allow the same incarnation of the connection to be reestablished
    until the TIME_WAIT state terminates.

    Even the TIME_WAIT state doesn't complete solve the second problem,
    given what is called TIME_WAIT assassination. RFC 1337 has more
    details.

    o The reason that the duration of the TIME_WAIT state is 2*MSL is
    that the maximum amount of time a packet can wander around a
    network is assumed to be MSL seconds. The factor of 2 is for the
    round-trip. The recommended value for MSL is 120 seconds, but
    Berkeley-derived implementations normally use 30 seconds instead.
    This means a TIME_WAIT delay between 1 and 4 minutes. Solaris 2.x
    does indeed use the recommended MSL of 120 seconds.

    A wandering duplicate is a packet that appeared to be lost and was
    retransmitted. But it wasn't really lost ... some router had
    problems, held on to the packet for a while (order of seconds, could
    be a minute if the TTL is large enough) and then re-injects the packet
    back into the network. But by the time it reappears, the application
    that sent it originally has already retransmitted the data contained
    in that packet.

    Because of these potential problems with TIME_WAIT assassinations, one
    should not avoid the TIME_WAIT state by setting the SO_LINGER option
    to send an RST instead of the normal TCP connection termination
    (FIN/ACK/FIN/ACK). The TIME_WAIT state is there for a reason; it's
    your friend and it's there to help you :-)

    I have a long discussion of just this topic in my just-released
    "TCP/IP Illustrated, Volume 3". The TIME_WAIT state is indeed, one of
    the most misunderstood features of TCP.

    I'm currently rewriting "Unix Network Programming" (see ``1.5 Where
    can I get source code for the book [book title]?''). and will include
    lots more on this topic, as it is often confusing and misunderstood.

    An additional note from Andrew:

    Closing a socket: if SO_LINGER has not been called on a socket, then
    close() is not supposed to discard data. This is true on SVR4.2 (and,
    apparently, on all non-SVR4 systems) but apparently not on SVR4; the
    use of either shutdown() or SO_LINGER seems to be required to
    guarantee delivery of all data.

    -------------------------------------------------------------------------------------------

    讨厌的 Socket TIME_WAIT 问题

    netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",state[key]}'

    会得到类似下面的结果,具体数字会有所不同:

    LAST_ACK 1
    SYN_RECV 14
    ESTABLISHED 79
    FIN_WAIT1 28
    FIN_WAIT2 3
    CLOSING 5
    TIME_WAIT 1669

    状态:描述
    CLOSED:无连接是活动的或正在进行
    LISTEN:服务器在等待进入呼叫
    SYN_RECV:一个连接请求已经到达,等待确认
    SYN_SENT:应用已经开始,打开一个连接
    ESTABLISHED:正常数据传输状态
    FIN_WAIT1:应用说它已经完成
    FIN_WAIT2:另一边已同意释放
    ITMED_WAIT:等待所有分组死掉
    CLOSING:两边同时尝试关闭
    TIME_WAIT:另一边已初始化一个释放
    LAST_ACK:等待所有分组死掉

    也就是说,这条命令可以把当前系统的网络连接状态分类汇总。

    下面解释一下为啥要这样写:

    一个简单的管道符连接了netstat和awk命令。

    ------------------------------------------------------------------

    每个TCP报文在网络内的最长时间,就称为MSL(Maximum Segment Lifetime),它的作用和IP数据包的TTL类似。

    RFC793指出,MSL的值是2分钟,但是在实际的实现中,常用的值有以下三种:30秒,1分钟,2分钟。

    注意一个问题,进入TIME_WAIT状态的一般情况下是客户端,大多数服务器端一般执行被动关闭,不会进入TIME_WAIT状态,当在服务

    器端关闭某个服务再重新启动时,它是会进入TIME_WAIT状态的。

    举例:
    1.客户端连接服务器的80服务,这时客户端会启用一个本地的端口访问服务器的80,访问完成后关闭此连接,立刻再次访问服务器的

    80,这时客户端会启用另一个本地的端口,而不是刚才使用的那个本地端口。原因就是刚才的那个连接还处于TIME_WAIT状态。
    2.客户端连接服务器的80服务,这时服务器关闭80端口,立即再次重启80端口的服务,这时可能不会成功启动,原因也是服务器的连

    接还处于TIME_WAIT状态。


    检查net.ipv4.tcp_tw当前值,将当前的值更改为1分钟:
    [root@aaa1 ~]# sysctl -a|grep net.ipv4.tcp_tw
    net.ipv4.tcp_tw_reuse = 0
    net.ipv4.tcp_tw_recycle = 0
    [root@aaa1 ~]#

    vi /etc/sysctl
    增加或修改net.ipv4.tcp_tw值:
    net.ipv4.tcp_tw_reuse = 1
    net.ipv4.tcp_tw_recycle = 1

    使内核参数生效:
    [root@aaa1 ~]# sysctl -p

    [root@aaa1 ~]# sysctl -a|grep net.ipv4.tcp_tw
    net.ipv4.tcp_tw_reuse = 1
    net.ipv4.tcp_tw_recycle = 1

    用netstat再观察正常


    这里解决问题的关键是如何能够重复利用time_wait的值,我们可以设置时检查一下time和wait的值
    #sysctl -a | grep time | grep wait
    net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait = 120
    net.ipv4.netfilter.ip_conntrack_tcp_timeout_close_wait = 60
    net.ipv4.netfilter.ip_conntrack_tcp_timeout_fin_wait = 120

    问一下TIME_WAIT有什么问题,是闲置而且内存不回收吗?

    是的,这样的现象实际是正常的,有时和访问量大有关,设置这两个参数: reuse是表示是否允许重新应用处于TIME-WAIT状态的

    socket用于新的TCP连接; recyse是加速TIME-WAIT sockets回收

     

    Q: 我正在写一个unix server程序,不是daemon,经常需要在命令行上重启它,绝大
    多数时候工作正常,但是某些时候会报告"bind: address in use",于是重启失
    败。

    A: Andrew Gierth
    server程序总是应该在调用bind()之前设置SO_REUSEADDR套接字选项。至于
    TIME_WAIT状态,你无法避免,那是TCP协议的一部分。

    Q: 如何避免等待60秒之后才能重启服务

    A: Erik Max Francis

    使用setsockopt,比如

    --------------------------------------------------------------------------
    int option = 1;

    if ( setsockopt ( masterSocket, SOL_SOCKET, SO_REUSEADDR, &option,
    sizeof( option ) ) < 0 )
    {
    die( "setsockopt" );
    }
    --------------------------------------------------------------------------

    Q: 编写 TCP/SOCK_STREAM 服务程序时,SO_REUSEADDR到底什么意思?

    A: 这个套接字选项通知内核,如果端口忙,但TCP状态位于 TIME_WAIT ,可以重用
    端口。如果端口忙,而TCP状态位于其他状态,重用端口时依旧得到一个错误信息,
    指明"地址已经使用中"。如果你的服务程序停止后想立即重启,而新套接字依旧
    使用同一端口,此时 SO_REUSEADDR 选项非常有用。必须意识到,此时任何非期
    望数据到达,都可能导致服务程序反应混乱,不过这只是一种可能,事实上很不
    可能。

    一个套接字由相关五元组构成,协议、本地地址、本地端口、远程地址、远程端
    口。SO_REUSEADDR 仅仅表示可以重用本地本地地址、本地端口,整个相关五元组
    还是唯一确定的。所以,重启后的服务程序有可能收到非期望数据。必须慎重使
    用 SO_REUSEADDR 选项。

    Q: 在客户机/服务器编程中(TCP/SOCK_STREAM),如何理解TCP自动机 TIME_WAIT 状
    态?

    A: W. Richard Stevens <1999年逝世,享年49岁>

    下面我来解释一下 TIME_WAIT 状态,这些在<>
    中2.6节解释很清楚了。

    MSL(最大分段生存期)指明TCP报文在Internet上最长生存时间,每个具体的TCP实现
    都必须选择一个确定的MSL值。RFC 1122建议是2分钟,但BSD传统实现采用了30秒。

    TIME_WAIT 状态最大保持时间是2 * MSL,也就是1-4分钟。

    IP头部有一个TTL,最大值255。尽管TTL的单位不是秒(根本和时间无关),我们仍需
    假设,TTL为255的TCP报文在Internet上生存时间不能超过MSL。

    TCP报文在传送过程中可能因为路由故障被迫缓冲延迟、选择非最优路径等等,结果
    发送方TCP机制开始超时重传。前一个TCP报文可以称为"漫游TCP重复报文",后一个
    TCP报文可以称为"超时重传TCP重复报文",作为面向连接的可靠协议,TCP实现必须
    正确处理这种重复报文,因为二者可能最终都到达。

    一个通常的TCP连接终止可以用图描述如下:

    client server
    FIN M
    close -----------------> (被动关闭)
    ACK M+1
    <-----------------
    FIN N
    <----------------- close
    ACK N+1
    ----------------->

    为什么需要 TIME_WAIT 状态?

    假设最终的ACK丢失,server将重发FIN,client必须维护TCP状态信息以便可以重发
    最终的ACK,否则会发送RST,结果server认为发生错误。TCP实现必须可靠地终止连
    接的两个方向(全双工关闭),client必须进入 TIME_WAIT 状态,因为client可能面
    临重发最终ACK的情形。

    {
    scz 2001-08-31 13:28

    先调用close()的一方会进入TIME_WAIT状态
    }

    此外,考虑一种情况,TCP实现可能面临先后两个同样的相关五元组。如果前一个连
    接处在 TIME_WAIT 状态,而允许另一个拥有相同相关五元组的连接出现,可能处理
    TCP报文时,两个连接互相干扰。使用 SO_REUSEADDR 选项就需要考虑这种情况。

    为什么 TIME_WAIT 状态需要保持 2MSL 这么长的时间?

    如果 TIME_WAIT 状态保持时间不足够长(比如小于2MSL),第一个连接就正常终止了。
    第二个拥有相同相关五元组的连接出现,而第一个连接的重复报文到达,干扰了第二
    个连接。TCP实现必须防止某个连接的重复报文在连接终止后出现,所以让TIME_WAIT
    状态保持时间足够长(2MSL),连接相应方向上的TCP报文要么完全响应完毕,要么被
    丢弃。建立第二个连接的时候,不会混淆。

    A: 小四

    在Solaris 7下有内核参数对应 TIME_WAIT 状态保持时间

    # ndd -get /dev/tcp tcp_time_wait_interval
    240000
    # ndd -set /dev/tcp tcp_time_wait_interval 1000

    缺省设置是240000ms,也就是4分钟。如果用ndd修改这个值,最小只能设置到1000ms,
    也就是1秒。显然内核做了限制,需要Kernel Hacking。

    # echo "tcp_param_arr/W 0t0" | adb -kw /dev/ksyms /dev/mem
    physmem 3b72
    tcp_param_arr: 0x3e8 = 0x0
    # ndd -set /dev/tcp tcp_time_wait_interval 0

    我不知道这样做有什么灾难性后果,参看<>的声明。

    Q: TIME_WAIT 状态保持时间为0会有什么灾难性后果?在普遍的现实应用中,好象也
    就是服务器不稳定点,不见得有什么灾难性后果吧?

    D: rain@bbs.whnet.edu.cn

    Linux 内核源码 /usr/src/linux/include/net/tcp.h 中

    #define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to successfully
    * close the socket, about 60 seconds */

    最好不要改为0,改成1。端口分配是从上一次分配的端口号+1开始分配的,所以一般
    不会有什么问题。端口分配算法在tcp_ipv4.c中tcp_v4_get_port中。

     

    Posted Jan 14 2010, 11:42 AM by wicky with no comments
    Filed under:
  • A Word on TIME_WAIT and CLOSE_WAIT


    http://blog.zhuzhaoyuan.com/2009/03/a-word-on-time_wait-and-close_wait/

    I’m surprised by the fact that so many network programmers don’t know TIME_WAIT and CLOSE_WAIT well, particularly those who use Java, C#, Python and etc.

    It is true, however, TIME_WAIT and CLOSE_WAIT are the most confusing two among TCP’s 11 states (CLOSED, LISTEN, SYN_SENT, SYN_RECV, ESTABLISHED, CLOSE_WAIT, LAST_ACK, FIN_WAIT1, FIN_WAIT2, CLOSING, and TIME_WAIT), which are displayed by netstat(1).

    Before going into detail, let me explain the terms first:
    Active Open: An end sends a SYN segment to the other end by calling connect(2). This end is usually called a client.
    Passive Open: An end issues a passive open by calling socket(2), bind(2), and listen(2) so that it can accept(2) the clients’ connections. This end is usually called a server.
    Active Close: An end performs active close when it calls close(2) first. It results a FIN segment being sent.
    Passive Close: The other end receives the FIN segment performs the passive close.
    MSL: Maximum Segment Lifetime, the maximum time a segment can live in the network before being discarded.

    Now take a look at the TCP state transition diagram.

    TCP State Transition Diagram 1

    TCP State Transition Diagram 1

    TCP State Transition Diagram 2

    TCP State Transition Diagram 2

    In the diagrams above, I denote the active open/close transitions with a green line and the passive open/close transitions with a blue line (Normal transitions are in bold). The end that performs the active close goes through the TIME_WAIT state; while the end performs the passive close enters the CLOSE_WAIT state. Note that either end (the server or the client) can perform the active close!

    tcp-close

    What’s the TIME_WAIT state for?
    1) When the final ACK being sent by the end that performed the active close was lost, the other end would resend a FIN. TCP maintains the information of the connection, hence it would resend the lost ACK rather than respond with an RST (interpreted as error).
    2) To allow wandering duplicates to expire in the network, so that the duplicate segments would not corrupt later connections.

    The value of TIME_WAIT delay is 2MSL, which is TCP implementation dependent and is generally about 1-4 minutes.

    CLOSE_WAIT happens when an end has received a FIN segment from the other end, to wait for the program to close the socket. Long duration of CLOSE_WAIT suggests that there might be a bug in your program. In fact, a TCP connection can stay in the CLOSE_WAIT state forever unless it is explicitly closed. It is the application’s responsibility to close its socket after use, to release the resource of the connection.

    Conclusion:
    In most cases, there is no need to worry about TIME_WAIT. It is a safety feature of TCP. But you really should take care of CLOSE_WAIT. Also note, if a connection is in CLOSE_WAIT, it would never end up in the TIME_WAIT state, and vice versa. BTW, if you haven’t read Richard Stevens’ Unix Network Programming, go out and buy one. It is a must-have for all network programmers, even if you do Windows programming.

    Download the dot files and msc file here:
    http://www.zhuzhaoyuan.com/download/tcp/tcp-state1.dot
    http://www.zhuzhaoyuan.com/download/tcp/tcp-state2.dot
    http://www.zhuzhaoyuan.com/download/tcp/tcp_close.msc

     

    Posted Jan 14 2010, 11:39 AM by wicky with no comments
    Filed under:
  • 震撼人心的新科技 - Sixth Sense

    http://www.cnbeta.com/articles/101755.htm

    美国MIT Media Lab(麻省理工学院媒体实验室)的天才学生普拉纳夫- (Prarnav Mistry),发明了一项结合实体世界和虚拟世界的科技,令人又惊又喜;喜的是,对于未來生活,悠游於实体和虚拟之间,将更自由无限,惊的是,对于现今的人们和企业而言,这场演讲是一提醒 :「讯息上身,才有未来」。

    以下是一段视频,长达13分52秒。但是,我相信你一定不会错过任何一秒。哪怕是它有关于科技,演讲人有浓重的印度口音,但是它如此贴近我们的生活,如此关怀人性,努力把人从“机器前的机器”里解放出来,以至于你会目不转睛地看完这段实况,而且遐想翩翩,愿意努力活到22世纪。

    如果说,Windows系统的图形化界面把人们从Dos系统下解放出来,用更符合直觉和人性的方法让人们对电脑进行操作是一次新技术的跨越的话,那么视频里这套Prarnav Mistry提供的第六感(Sixth Sense)装置,则是另外一次意义更为深远的腾跃。和它相比,目前甚嚣尘上的所谓“物流网”,只是这个新技术的小小注脚,无论在深度还是广度上,都无法与之比拟。 网络和电脑技术,终于使得数字世界和现实世界全面融合,人类升级为真正意义上的数位人!新时代就要开始了!

    Posted Jan 14 2010, 10:14 AM by wicky with no comments
    Filed under:
  • 身份证最后一位可能为X

    GB11643-1999 公民身份号码中规定,最后一位校验码是根据前面十七位数字码,按照ISO 7064:1983.MOD 11-2校验码计算出来的检验码。
    公式如下:
      ∑(aIdea*WIdea) mod 11 ( i = 2, 3, ..., 18 ) (1)
      "*" 表示乘号
      i--------表示身份证号码每一位的序号,从右至左,最左侧为18,最右侧为1。
      aIdea-----表示身份证号码第 i 位上的号码
      WIdea-----表示第 i 位上的权值 WIdea = 2^(i-1) mod 11
      计算公式 (1) 令结果为 R
    根据下表找出 R 对应的校验码即为要求身份证号码的校验码C。
      R 0 1 2 3 4 5 6 7 8 9 10
      C 1 0 X 9 8 7 6 5 4 3 2
    由此看出 X 就是 10,罗马数字中的 10 就是X,所以在新标准的身份证号码中可能含有非数字的字母X。

    Posted Jan 04 2010, 08:28 PM by wicky with no comments
    Filed under:
  • Windows Messenger 5.1 and Vista/Win7 Scroll Bar Issue

    http://www.systemsabuse.com/2007/10/18/how-do-you-install-windows-messenger-51-on-vista-with-uac-enabled/ 

    Vista - Messenger 5.1 SIP - workaround:

    1) Setup windows messenger 5.1.0.639 (SIP protocol).
    2) Download riched20.dll (version 5.0.150.0) from, for instance: http://www.dll-files.com/dllindex/dll-files.shtml?riched20
    3) Copy riched20.dll to messenger folder application.

    This riched20.dll version resolve scrollbar issue.

    Posted Dec 28 2009, 12:11 PM by wicky with no comments
    Filed under:
  • Microsoft Windows XP Pro with SP3 VOL MSDN

    http://www.iamkane.com/article.asp?id=2

    序列号:
    MRX3F-47B9T-2487J-KWKMF-RPWBY(chs可用 )

    CM3HY-26VYW-6JRYC-X66GX-JVY2D

    DP7CM-PD6MC-6BKXT-M8JJ6-RPXGJ

    F4297-RCWJP-P482C-YY23Y-XH8W3

    HH7VV-6P3G9-82TWK-QKJJ3-MXR96

    HCQ9D-TVCWX-X9QRG-J4B2Y-GR2TT

    QC986-27D34-6M3TY-JJXP9-TBGMD

    MRX3F-47B9T-2487J-KWKMF-RPWBY

    M6TF9-8XQ2M-YQK9F-7TBB2-XGG88

    换Key的vbs

    ON ERROR RESUME NEXT
    Dim VOL_PROD_KEY
    if Wscript.arguments.count<1 then
    VOL_PROD_KEY=InputBox("使用说明(OEM版无效):"&vbCr&vbCr&" 本脚本程序将修改当前 Windows 的序列号。请先使用算号器算出匹配当前 Windows 的序列号,复制并粘贴到下面空格中。"&vbCr&vbCr&"输入序列号(默认为 XP VLK):","Windows XP/2003 序列号更换工具","请在此处输入正确的Microsoft Windows XP/2003 产品密钥")
    if VOL_PROD_KEY="" then
    Wscript.quit
    end if
    else
    VOL_PROD_KEY = Wscript.arguments.Item(0)
    end if
    VOL_PROD_KEY = Replace(VOL_PROD_KEY,"-","") ''remove hyphens if any
    for each Obj in GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf ("win32_WindowsProductActivation")
    result = Obj.SetProductKey (VOL_PROD_KEY)
    if err = 0 then
    Wscript.echo "您的 Windows CD-KEY 修改成功。请检查系统属性。"
    end if
    if err <> 0 then
    Wscript.echo "修改失败!请检查输入的 CD-KEY 是否与当前 Windows 版本相匹配。"
    Err.Clear
    end if
    Next

    Posted Dec 27 2009, 07:29 PM by wicky with no comments
    Filed under:
  • Windows 2008 R2 试用版序列号

    Svr 2008 评估版序列号,可以重置五次每次180天,总计可以免费使用900天
    Product Key Type = Retail:TB:Eval   (Evaluation Keys)
    Crypto Base ID = 168
    Rearm count = 5 !

    Windows Web Server 2008 R2 = KBV3Q-DJ8W7-VPB64-V88KG-82C49
    = 00500-001-0000554-84*** = X15-34676
    Windows Server 2008 R2 Standard = 4GGC4-9947F-FWFP3-78P6F-J9HDR
    = 00477-001-0000347-84*** = X15-34648
    Windows Server 2008 R2 Enterprise = 7PJBC-63K3J-62TTK-XF46D-W3WMD
    = 00486-001-0001204-84*** = X15-34815
    Windows Server 2008 R2 Datacenter = QX7TD-2CMJR-D7WWY-KVCYC-6D2YT
    = 00496-001-0001526-84*** = X15-34820
    下面是我用slmgr.vbs /rearm重置过一次后的截图
    这个激活为啥我要说是“官方”的,(加了引号),因为这个是在微软允许的范围之内的。
      现在激活的方法除了购买正版系列号外,网络上也流传了很多方法,但是那些免费的方法首先侵犯了微软的使用协议。另外很多方法是采用替换法,或刷BIOS,这样的结果是带来计算机的损坏或系统的不稳定,实在是得不偿失。下面说说我的方法。这个方法经过笔者的亲自测试。此方法适用于任何的 win7版本。
    1.首先安装后,有一个30天的使用期。

    2.在30天试用期即将结束时,用rearm命令后重启电脑,剩余时间又回复到30天。微软官方文档中声明该命令只能重复使用3次,也说是说总共可以免费体验120天。

    方法如下:打开附件—–命令提示符。(注意要使用右键管理员方式运行)。在命令行中输入“slmgr.vbs/rearm”的命令延长使用期30天

     

    Posted Dec 24 2009, 04:34 PM by wicky with 1 comment(s)
    Filed under:
  • KILL SESSION 还存在而不马上释放得问题

    http://www.sosdb.com/jdul/dispbbs.asp?boardID=2&ID=248

    我们知道,在Oracle数据库中,可以通过kill session的方式来终止一个进程,其基本语法结构为: 

    alter system kill session 'sid,serial#' ; 
     

    被kill掉的session,状态会被标记为killed,Oracle会在该用户下一次touch时清除该进程. 


    我们发现当一个session被kill掉以后,该session的paddr被修改,如果有多个session被kill,那么多个session
    的paddr都被更改为相同的进程地址:





    SQL> select saddr,sid,serial#,paddr,username,status from v$session where username is not null;
    

    SADDR SID SERIAL# PADDR USERNAME STATUS
    -------- ---------- ---------- -------- ------------------------------ --------
    542E0E6C 11 314 542B70E8 EYGLE INACTIVE
    542E5044 18 662 542B6D38 SYS ACTIVE


    SQL> alter system kill session '11,314';

    System altered.

    SQL> select saddr,sid,serial#,paddr,username,status from v$session where username is not null;

    SADDR SID SERIAL# PADDR USERNAME STATUS
    -------- ---------- ---------- -------- ------------------------------ --------
    542E0E6C 11 314 542D6BD4 EYGLE KILLED
    542E5044 18 662 542B6D38 SYS ACTIVE


    SQL> select saddr,sid,serial#,paddr,username,status from v$session where username is not null;

    SADDR SID SERIAL# PADDR USERNAME STATUS
    -------- ---------- ---------- -------- ------------------------------ --------
    542E0E6C 11 314 542D6BD4 EYGLE KILLED
    542E2AA4 14 397 542B7498 EQSP INACTIVE
    542E5044 18 662 542B6D38 SYS ACTIVE

    SQL> alter system kill session '14,397';

    System altered.

    SQL> select saddr,sid,serial#,paddr,username,status from v$session where username is not null;

    SADDR SID SERIAL# PADDR USERNAME STATUS
    -------- ---------- ---------- -------- ------------------------------ --------
    542E0E6C 11 314 542D6BD4 EYGLE KILLED
    542E2AA4 14 397 542D6BD4 EQSP KILLED
    542E5044 18 662 542B6D38 SYS ACTIVE



    在这种情况下,很多时候,资源是无法释放的,我们需要查询spid,在操作系统级来kill这些进程. 

    但是由于此时v$session.paddr已经改变,我们无法通过v$session和v$process关联来获得spid 

    那还可以怎么办呢? 

    我们来看一下下面的查询:



      SQL> SELECT s.username,s.status,
    
    2 x.ADDR,x.KSLLAPSC,x.KSLLAPSN,x.KSLLASPO,x.KSLLID1R,x.KSLLRTYP,
    3 decode(bitand (x.ksuprflg,2),0,null,1)
    4 FROM x$ksupr x,v$session s
    5 WHERE s.paddr(+)=x.addr
    6 and bitand(ksspaflg,1)!=0;


    USERNAME STATUS ADDR KSLLAPSC KSLLAPSN KSLLASPO KSLLID1R KS D
    ------------------------------ -------- -------- ---------- ---------- ------------ ---------- -- -
    542B44A8 0 0 0
    ACTIVE 542B4858 1 14 24069 0 1
    ACTIVE 542B4C08 26 16 15901 0 1
    ACTIVE 542B4FB8 7 46 24083 0 1
    ACTIVE 542B5368 12 15 24081 0 1
    ACTIVE 542B5718 15 46 24083 0 1
    ACTIVE 542B5AC8 79 4 15923 0 1
    ACTIVE 542B5E78 50 16 24085 0 1
    ACTIVE 542B6228 754 15 24081 0 1
    ACTIVE 542B65D8 1 14 24069 0 1
    ACTIVE 542B6988 2 30 14571 0 1

    USERNAME STATUS ADDR KSLLAPSC KSLLAPSN KSLLASPO KSLLID1R KS D
    ------------------------------ -------- -------- ---------- ---------- ------------ ---------- -- -
    SYS ACTIVE 542B6D38 2 8 24071 0
    542B70E8 1 15 24081 195 EV
    542B7498 1 15 24081 195 EV

    SYS INACTIVE 542B7848 0 0 0
    SYS INACTIVE 542B7BF8 1 15 24081 195 EV

    16 rows selected.




    我们注意,红字标出的部分就是被Kill掉的进程的进程地址. 

    简化一点,其实就是如下概念:


    SQL> select p.addr from v$process p where pid <> 1
    2 minus
    3 select s.paddr from v$session s;

    ADDR
    --------
    542B70E8
    542B7498


     

    Ok,现在我们获得了进程地址,就可以在v$process中找到spid,然后可以使用Kill或者orakill在系统级来杀掉这些进程.

    实际上,我猜测:

    当在Oracle中kill session以后, Oracle只是简单的把相关session的paddr 指向同一个虚拟地址.

    此时v$process和v$session失去关联,进程就此中断.

    然后Oracle就等待PMON去清除这些Session.所以通常等待一个被标记为Killed的Session退出需要花费很长的时间.

    如果此时被Kill的process,重新尝试执行任务,那么马上会收到进程中断的提示,process退出,此时Oracle会立即启动PMON
    来清除该session.这被作为一次异常中断处理.

     

    Posted Dec 22 2009, 03:27 PM by wicky with 2 comment(s)
    Filed under:
  • Foxmail 6.5 收取hotmail live msn邮件

    http://sunya.org.cn/article.asp?id=1259

    今天,试了下用foxmail收取gmail 跟msn邮件
    能成功收下!

    在6.5 beta 3版本已经全面支持hotmail了,只是目前没有随安装包一起发放出来

    自己琢磨了一下,就缺一个文件msidcrl40.dll,找了半天都是4.0的都不能用

    后来直接在live mail里面挖出来一个5.0的

    将其放到Foxmail安装路径3rdParty目录下

    然后在到注册表HKEY_CURRENT_USER\Software\Aerofox\Foxmail\General下,新建“字符串值”SupportHotmail,值为1。

    重新启动foxmail就可以了,新增hotmail帐号时候就会有个http服务器

    还会有个路径
    http://mail.services.live.com/DeltaSync_v2.0.0/Sync.aspx

    填上用户名、密码就可以使用了。

    PS:由于是HTTP登录,那么在客户端上Foxmail删除邮件,会同步删除hotmail上的邮件。所以要特别注意下,以免重要邮件被删除。

    PS2:附上msidcrl40.dll版本是5的,从live mail客户端里扒出的,还有注册表信息,直接导入就可以了
    点击下载

    Posted Dec 12 2009, 08:46 PM by wicky with no comments
    Filed under:
  • Overview of SQL Server 2008 Servicing Installation

    http://msdn.microsoft.com/en-us/library/dd638062.aspx

    You can upgrade any installed SQL Server 2008 component with a SQL Server 2008 servicing update. If the version level of an existing SQL Server 2008 component is later than the update version level, the Setup program will exclude it from the update.

    The following considerations apply when you install SQL Server 2008 updates:

    • All features that belong to an instance of SQL Server must be updated at the same time. For example, when you update the Database Engine, you must also update Analysis Services and Reporting Services components if they are installed as part of the same instance of SQL Server. Shared features, such as Management Tools, Business Intelligence Development Studio, and SQL Server Integration Services, must always be updated to the most recent update. If a component or instance in the feature tree is not selected, the component or instance will not be updated.
    • By default, SQL Server 2008 update log files are saved to %Program Files%\Microsoft SQL Server\100\Setup Bootstrap\LOG\.
    • Starting with Service Pack 1 (SP1), you can now slipstream an update with the original media to run the original media and the update at the same time. For more information, see Slipstream a SQL Server Update.
    • Before you apply a SQL Server 2008 servicing update, we recommend that you consider backing up your data.
    • SQL Server updates are available through Microsoft Update. We recommend that you scan for updates regularly to keep your instance of SQL Server updated and secure.

    For more information, see How to apply a SQL Server 2008 update to a failover cluster instance in the Microsoft Knowledge Base.

    The recommended disk space requirements are approximately 2.5 times the size of the package to install, download, and extract the package.

    The size of SP1 packages are listed here:

    • X86: 270 MB
    • X64: 331 MB
    • Ia64: 320 MB

    After installing SP1, you can remove the downloaded package. Any temporary files are removed automatically.

    This section discusses the SQL Server 2008 update installation, including how to do the following:

    • Prepare for a SQL Server 2008 update installation
    • Install SQL Server 2008 updates
    • Restart services and applications

    Prepare for a SQL Server 2008 Update Installation

    You must do the following before you install SQL Server 2008 updates:

    • Back up your SQL Server 2008 system databases — Before you install SQL Server 2008 updates, back up the master, msdb, and model databases. Installing a SQL Server 2008 update changes these databases, making them incompatible with earlier versions of SQL Server 2008. Backups of these databases are required if you decide to reinstall SQL Server 2008 without these updates.
      It is also prudent to back up your user databases.
    Dd638062.note(en-us,SQL.100).gifImportant:
    When you apply updates to instances of SQL Server that participate in a replication topology, you must back up your replicated databases together with your system databases before you apply the update.

    • Back up your Analysis Services databases, configuration file, and repository — Before you update an instance of Analysis Services, you should back up the following:
      • Analysis Services databases. By default, these are installed to C:\Program Files\Microsoft SQL Server\MSAS10\<InstanceID>\OLAP\Data\.
      • Analysis Services configuration setting in the msmdsrv.ini configuration file. By default, this is located in the C:\Program Files\Microsoft SQL Server\MSAS10\<InstanceID>\OLAP\Config\ directory.
      • (Optional) The database that contains the Analysis Services repository. This step is required only if Analysis Services was configured to work with the Decision Support Objects (DSO) library.
    Dd638062.note(en-us,SQL.100).gifNote:
    Failure to back up your Analysis Services databases, configuration file, and repository will prevent you from reverting an updated instance of Analysis Services to the earlier version.

    • Verify that the system databases have sufficient free space — If the autogrow option is not selected for the master and msdb system databases, these databases each must have at least 500 KB of free space. To verify that the databases have sufficient space, run the sp_spaceused system stored procedure on the master and msdb databases. If the unallocated space in either database is less than 500 KB, increase the size of the database. For more information, see "Expanding a Database" in SQL Server Books Online.
    • Stop Services and Applications — To avoid a possible restart of the system, stop all applications and services that make connections to the instances of SQL Server that are being upgraded, before installing SQL Server 2008 updates. These include SQL Server Management Studio, Business Intelligence Development Studio, Control Panel, and Add or Remove Programs.
    Dd638062.note(en-us,SQL.100).gifNote:
    You cannot stop services in a failover cluster environment. For more information, see the failover cluster installation section later in this topic.

    • To eliminate the requirement to restart your computer after update installation, Setup will show a list of processes that are locking files. If the update Setup program must end a service during installation, it will restart the service after the installation finishes.
    • If Setup determines that files are locked during installation, you might have to restart your computer after the installation finishes. If it is required, Setup prompts you to restart your computer.

     

    Install SQL Server 2008 Updates

    This section describes the installation process.

    Dd638062.note(en-us,SQL.100).gifImportant:
       SQL Server 2008 updates must be installed under an account that has administrative privileges on the computer where they will be installed.

    Starting a SQL Server 2008 Update

    To install a SQL Server 2008 update, run the self-extracting package file SQLServer2008-KBxxxxxx-PPP.exe, where PPP indicates the specific platform.

    Dd638062.note(en-us,SQL.100).gifNote:
    To apply updates to SQL Server 2008 components that are part of a failover cluster, see the section for failover cluster installation. For more information about how to run an update installation in unattended mode, see How to: Install SQL Server 2008 (Setup).

    Slipstream a SQL Server Update

    Overview:

    Slipstreaming is integrating a SQL Server 2008 update and the original installation media so that the original media and the update are installed at the same time. When you run the original release version of SQL Server 2008 Setup, the Setup program copies itself on the local computer, and then re-runs from the local copy. Therefore, if there is a later version of Setup on the computer, the Setup program runs the updated Setup.

    Slipstreaming is supported in the following scenarios:

    • Original media and service pack
    • Original media, service pack, and cumulative update
      Dd638062.note(en-us,SQL.100).gifNote:
      Slipstreaming an update with the original media but without the service pack is not supported.

      Dd638062.note(en-us,SQL.100).gifImportant:
      For SQL Server Express, you must download the version with the service pack and slipstream cumulative updates as needed.

    There are several ways that you can slipstream an update:

    Option 1: Install the latest update with the original release version of SQL Server 2008 Setup directly:

    We recommend that you use this option if you are running the upgrade on a few computers.

    1. Install the following prerequisites that are required for SQL Server 2008.
      • Microsoft Windows Installer 4.5
      • Microsoft .NET Framework 3.5 Service Pack 1
        Dd638062.note(en-us,SQL.100).gifNote:
        On the IA-64 platform, the .NET Framework 3.5 is not supported, and the .NET Framework 2.0 SP2 is required. You must install the .NET Framework 2.0 SP2 from the source media because it is not available from the Microsoft Download Center. The .NET Framework 2.0 SP2 is located in the following folder on the source media:

        Drive_Letter:\ia64\redist\2.0\NetFx20SP2_ia64.exe

    2. Download the service package and cumulative update that you want to slipstream. Select the language or architecture package that matches your environment. Service packages must match both language and architecture; cumulative updates are language-neutral.
    3. Double-click the service pack to install the SQL Server 2008 Setup support files. To confirm that the updated setup is installed, search for the "SQL Server 2008 Setup Support Files" entry by using the Add or Remove Programs item in Control Panel in operating systems that are earlier than Windows Vista. In Windows Vista or later versions of Windows, view the entry by using the Programs and Features item in Control Panel.
    4. For each package, extract the contents of the package by running the following script at the command prompt:
      <name of the PCU or CU package>.exe /x:<Root of path to extract to>\<PCU | CU>
      Dd638062.note(en-us,SQL.100).gifNote:

      The name of the package is in the form:

      PCU: SQLServer2008SP1-<KB Article>-<Architecture>-<Language>.exe

      CU: SQLServer2008SP1-<KB Article>-<Architecture>.exe

      The architecture placeholder represents the different hardware platforms. For example, it can represent one of the following folders:

      x86

      x64

      IA64

      For example, run the following commands to extract the contents of the PCU package:

      SQLServer2008- KB123456-IA64.exe /x:c:\MyUpdate\PCU

      SQLServer2008- KB123456-x64.exe /x:c:\MyUpdate\PCU

      SQLServer2008- KB123456-x86.exe /x:c:\MyUpdate\PCU

      If you want to include a CU based on the PCU, extract out the CU packages to c:\MyUpdate\CU

    5. Start the SQL Server 2008 Setup program and specify the path for the service pack and cumulative update files by using the /PCUSource and /CUSource parameters. For example, here is a path based on the extracted location indicated in step 4:
      Setup.exe /PCUSource = c:\MyUpdate\PCU /CUSource= c:\MyUpdate\CU
      Dd638062.note(en-us,SQL.100).gifNote:

      For SQL Server Express SP1 or later, only the /CUSource parameter is supported.

      If you are slipstreaming SQL Server in WOW64, you need to do one of the following:

      • To skip the installation center, specify the /Action parameter and the /x86 parameter on the command line.
      • Or, on the Options page of the Installation Center, select x86.
    Option 2: Slipstream Express Core Service Pack with cumulative update:

    We recommend that you use this option if you are running the upgrade on a few computers.

    1. Install the following prerequisites that are required for SQL Server 2008.
      • Microsoft Windows Installer 4.5
      • Microsoft .NET Framework 3.5 Service Pack 1
      Dd638062.note(en-us,SQL.100).gifNote:
      SQL Server Express only requires .NET 2.0 SP2, but this version is not publicly available so you need to install .NET 3.5 SP1 instead.

    2. Download the SQL Server Express core package and cumulative update that you want to slipstream. Select the language or architecture of SQL Server Express that matches your environment. The cumulative updates are language-neutral.
    3. Extract the contents of the cumulative update package by running the following script at the command prompt:
      <CU package>.exe /x:<Root of path to extract to>\<CU>
      Dd638062.note(en-us,SQL.100).gifNote:

      The name of the package is in the form:

      CU: SQLServer2008-<KB Article>-<Architecture>.exe

      The architecture placeholder represents the different hardware platforms. For example, it can represent one of the following folders:

      x86

      x64

      IA64

      For example, run the following commands to extract the contents of the cumulative update package:

      SQLServer2008-KB123456-IA64.exe /x:c:\MyUpdate\CU

      SQLServer2008-KB123456-x64.exe /x:c:\MyUpdate\CU

      SQLServer2008-KB123456-x86.exe /x:c:\MyUpdate\CU

    4. Start the SQL Server 2008 Setup program and specify the path for the service pack and cumulative update files by using the /CUSource parameters.
      Dd638062.note(en-us,SQL.100).gifNote:

      For SQL Server Express SP1 or later, only the /CUSource parameter is supported.

    • Microsoft Windows Installer 4.5
    • Microsoft .NET Framework 3.5 Service Pack 1
    Option 3: Update the original media files:

    We recommend that you use this option for running a patched setup on many computers or large deployments, or for when an administrator wants to make this patched setup available to users. We also recommend that you test fully before you make this option available to other users. This option is supported in the following scenarios:

    • Original media and service pack
    • Original media, service pack, and cumulative update
    1. Download the service pack and the optional cumulative update based on the service pack that you want to use to update the original media files. You must download the service pack and updates for all platforms (x86, x64, and IA-64) because the original media contains the files for each platform. For example, you must either download three packages for merging the original media and just the service pack or six packages for merging the original media, service pack, and cumulative update.
    2. For each package, extract the contents of the package by running the following script at the command prompt:
      <name of the PCU or CU package>.exe /x:<Root of path to extract to>\<PCU | CU>
      Dd638062.note(en-us,SQL.100).gifNote:

      The name of the package is in the form:

      PCU: SQLServer2008SP1-<KB Article>-<Architecture>-<Language>.exe

      CU: SQLServer2008SP1-<KB Article>-<Architecture>.exe

      The architecture placeholder represents the different hardware platforms. For example, it can represent one of the following folders:

      x86

      x64

      IA64

      For example, run the following commands to extract the contents of the PCU package:

      SQLServer2008- KB123456-IA64.exe /x:c:\MyUpdate\PCU

      SQLServer2008- KB123456-x64.exe /x:c:\MyUpdate\PCU

      SQLServer2008- KB123456-x86.exe /x:c:\MyUpdate\PCU

      The previous command merges the three architectures into a single folder. If you want to include a CU based on the PCU, extract the cumulative update packages out to c:\MyUpdate\CU

    3. Copy the contents of the SQL Server 2008 DVD to a local folder, for example SQLServer2008RTM.
    4. To update the files in the original installation media, copy the SQLSupport.msi file from the C:\MyUpdate\PCU\<Architecture>\setup\<Language LCID>\sqlsupport.msi to C:\SQLServer2008RTM\<Architecture>\Setup\sqlsupport.msi. Ensure that you copy Sqlsupport.msi for each architecture.
      Dd638062.note(en-us,SQL.100).gifNote:
      If you are using slipstreaming to integrate a cumulative update package also, use the files in the extracted cumulative update folder instead

    5. Copy the Setup.exe and Setup.rll files from the C:\MyUpdate\PCU\ folder to the root folder that contains the source media from the DVD.
      Dd638062.note(en-us,SQL.100).gifNote:
      If you are using slipstream to integrate a cumulative update package also, use the files in the extracted cumulative update folder instead.

    6. To update the files in the original installation media, copy all files without the folders, except the Microsoft.SQL.Chainer.PackageData.dll, in c:\MyUpdate\PCU\<architecture> to C:\SQLServer2008RTM\<architecture>
      Dd638062.note(en-us,SQL.100).gifNote:
      If you are using slipstream to integrate a cumulative update package also, use the files in the extracted cumulative update folder instead

    7. Start the Setup.exe program that is located at C:\SQLServer2008RTM and specify the values for /PCUSource and /CUSource parameters. For example, C:\SQLServer2008RTM\Setup.exe /PCUSource=c:\MyUpdate\PCU /CUSource= c:\MyUpdate\CU.
      Dd638062.note(en-us,SQL.100).gifNote:
      If you place the folder on a share for user installs, set the /PCUSource and /CUSource parameters to a UNC path.

    Applying a SQL Server 2008 Update to a Failover Cluster Instance

    For more information about how to install updates to a SQL Server 2008 failover cluster, see How to apply a SQL Server 2008 update to a failover cluster instance in the Microsoft Knowledge Base.

    Rebuilding a SQL Server 2008 Failover Cluster Node

    If you must rebuild a node in the failover cluster after updates were applied, follow these steps:

    1. Rebuild the node in the failover cluster. For more information about rebuilding a node, see "How to: Recover from Failover Cluster Failure in Scenario 1" in SQL Server Books Online.
    2. Run the original SQL Server 2008 Setup program to install SQL Server 2008 on the failover cluster node.
    3. Run SQL Server 2008 updates Setup on the node that you have added.

    Restart Services and Applications

    When the Setup program is finished, it might prompt you to restart the computer. After the system restarts, or after the Setup program finishes without requesting a restart, use the Services node in Control Panel to restart the services that you stopped before you applied the SQL Server 2008 updates. This includes services such as Distributed Transaction Coordinator and the Microsoft Search services, or instance-specific equivalents.

    Restart the applications that you closed before you ran SQL Server 2008 update Setup. You might also want to make another backup of the upgraded master, msdb, and model databases immediately after successful installation.

    Uninstalling updates to SQL Server 2008

    You can uninstall SQL Server 2008 cumulative updates or service packs from Programs and Features in Control Panel. Each cumulative update is listed separately. However, when a service pack is installed that is higher than the cumulative updates, the cumulative update entries are hidden and become available only if you uninstall the service pack.

    To uninstall any service packs and updates, you must start with the latest update or service pack applied to the instance of SQL Server and work backward. In each of the following examples, SQL Server ends up with Cumulative Update 1 after uninstall has been completed for the other service packs or updates:

    • For an instance of SQL Server 2008 with Cumulative Update 1 and SP1 installed, uninstall SP1.
    • For an instance of SQL Server 2008 with Cumulative Update 1, SP1, and Cumulative Update 2 installed, uninstall Cumulative Update 2 first and then uninstall SP1.
    Posted Dec 05 2009, 09:43 PM by wicky with no comments
    Filed under:
More Posts Next page »
Copyright SDT, 2006-2009. All rights reserved.