• 实战给 Windows 服务器升级硬盘

    单位的服务器250G硬盘满了。新买了2个1T的。目前没有域,如果重装系统的话,不得不重新建用户,设权限,很麻烦。幸好可以借助Windows Server 的镜像卷(软 RAID1)功能实现无缝升级。

    步骤0:先把原来的 RAID0分区给备份掉。这个没法镜像。反正也没啥重要的东西,直接copy出去就行了。
    步骤1:把原来的硬盘2拿掉,换上一个新硬盘。

    step1
    刚换上一个硬盘的样子

    步骤2:在磁盘管理里面删掉原来的硬盘2。给启动分区和数据分区做镜像。
    我在这一步走了一点弯路:

    step2 wrong
    错误的分区
    step2 right
    正确的分区

    看出来错在哪儿了没?对,启动镜像的首扇区必须和原来的启动盘的相同,否则可能无法启动。
    原来的盘有个31M的DELL的分区,所以新的盘也必须预留出来这一块。

    步骤3:拿掉旧的硬盘1,尝试用新的硬盘启动。
    如果这一步成功,基本上就万事大吉了。不成功参见步骤2。

    步骤4:从磁盘管理删掉纳掉的旧硬盘,扩展数据分区。(如果先镜像了,就不让扩展了。)

    步骤5:挂上第2块新硬盘,继续给启动分区和数据分区镜像。并重建 RAID0 分区, 把原来的RAID0分区的数据copy回来。

    大功告成
    大功告成

    整个过程耗时半天左右。除了中间1次重新启动以外,整个过程并不影响服务器的使用。这个办法对于仅有一块硬盘的服务器也同样适用,只是省了步骤4和步骤1的一部分。

  • 一些关于 Oracle 的 Link

    一些很好用的script: http://vsbabu.org/oracle/

    关于 Oracle 的回收站

    在Oracle 里访问Oracle:
    计算机世界网-Oracle 异构服务实践

  • 用 Javascript 控制记事本

    var WshShell = WScript.CreateObject("WScript.Shell");
    WshShell.AppActivate("notepad");
    WshShell.Run("notepad", 1, false);
    WScript.Sleep(500);
    WScript.Sleep(300);
    WshShell.SendKeys("1{+}");
    WScript.Sleep(150);
    WshShell.SendKeys("2");
    WScript.Sleep(150);
    WshShell.SendKeys("~");
    WScript.Sleep(150);
    WshShell.SendKeys("*3");
    WScript.Sleep(150);
    WshShell.SendKeys("~");
    WScript.Sleep(250);
  • Vim 笔记

    关于 \t 和 \n 要注意的是,如果你要匹配它们,也就是说出现在匹配串中的时候
    要写 \t 和 \n,但是如果你要替换成它们,就不应该直接写 \t \n,而要用 Ctrl+V
    或者 输入一个蓝色的特殊字符。

    例如:
    :s/\n/ABC^M/g
    :s/\t/^T^T/g

    而下面两个写法都是不对的:
    :s/\n/ABC\n/g
    :s/^T/^T^T/g

  • 备份 Oracle

    1. 表单位
      1. 备份指定表
        exp icdmain/icd rows=y indexes=n compress=n buffer=65536 feedback=100000 file=exp_icdmain_table_yyyymmdd.dmp log=exp_icdmain_table_yyyymmdd.log tables=icdmain.commoninformation,icdmain.serviceinfo,icdmain.dealinfo
      2. 恢复所有的表
        imp icdmain/icd fromuser=icdmain touser=icdmain rows=y indexes=n commit=y buffer=65536 feedback=100000 ignore=y file=exp_icdmain_table_yyyymmdd.dmp log=imp_icdmain_table_yyyymmdd.log
      3. 恢复其中一部分表
        imp icdmain/icd fromuser=icdmain touser=icdmain rows=y indexes=n commit=y buffer=65536 feedback=100000 ignore=y file=exp_icdmain_table_yyyymmdd.dmp log=imp_icdmain_table_yyyymmdd.log tables=commoninformation,serviceinfo
    2. 用户单位
      1. 备份指定用户的所有对象
        exp icdmain/icd rows=y indexes=n compress=n buffer=65536 feedback=100000 owner=icdmain file=exp_icdmain_user_yyyymmdd.dmp log=exp_icdmain_user_yyyymmdd.log
      2. 恢复指定用户的所有对象
        imp icdmain/icd fromuser=icdmain touser=icdmain rows=y indexes=n commit=y buffer=65536 feedback=100000 ignore=y file=exp_icdmain_user_yyyymmdd.dmp log=imp_icdmain_user_yyyymmdd.log
      3. 恢复指定用户的的一部分表
        imp icdmain/icd fromuser=icdmain touser=icdmain rows=y indexes=n commit=y buffer=65536 feedback=100000 ignore=y file=exp_icdmain_user_yyyymmdd.dmp log=imp_icdmain_user_yyyymmdd.log tables=commoninformation,serviceinfo
    3. 整体备份
      1. 备份整个数据库
        exp system/manager rows=y indexes=n compress=n buffer=65536 feedback=100000 full=y inctype=complete file=exp_fulldb_yyyymmdd.dmp log=exp_fulldb_yyyymmdd.log
      2. 整个数据库的增量备份
        exp system/manager rows=y indexes=n compress=n buffer=65536 feedback=100000 full=y inctype=incremental file=exp_fulldb_zl_yyyymmdd.dmp log=exp_fulldb_zl_yyyymmdd.log
      3. 从整体备份恢复所有对象
        imp system/manager rows=y indexes=n commit=y buffer=65536 feedback=100000 ignore=y full=y file=exp_fulldb_yyyymmdd.dmp log=imp_fulldb_yyyymmdd.log
      4. 从增量备份恢复所有对象
        imp system/manager rows=y indexes=n commit=y buffer=65536 feedback=100000 ignore=y full=y inctype=restore file=exp_fulldb_zl_yyyymmdd.dmp log=imp_fulldb_zl_yyyymmdd.log
  • 缩小 Oracle 表空间

    ———– maxshrink.sql ———————————-

    set verify off
    column file_name format a50 word_wrapped
    column smallest format 999,990 heading "Smallest|Size|Poss."
    column currsize format 999,990 heading "Current|Size"
    column savings  format 999,990 heading "Poss.|Savings"
    break on report
    compute sum of savings on report
    
    column value new_val blksize
    select value from v$parameter where name = 'db_block_size'
    /
    
    select file_name,
           ceil( (nvl(hwm,1)*&&blksize)/1024/1024 ) smallest,
           ceil( blocks*&&blksize/1024/1024) currsize,
           ceil( blocks*&&blksize/1024/1024) -
           ceil( (nvl(hwm,1)*&&blksize)/1024/1024 ) savings
    from dba_data_files a,
         ( select file_id, max(block_id+blocks-1) hwm
             from dba_extents
            group by file_id ) b
    where a.file_id = b.file_id(+)
    /
    
    column cmd format a75 word_wrapped
    
    select 'alter database datafile '''||file_name||''' resize ' ||
           ceil( (nvl(hwm,1)*&&blksize)/1024/1024 )  || 'm;' cmd
    from dba_data_files a,
         ( select file_id, max(block_id+blocks-1) hwm
             from dba_extents
            group by file_id ) b
    where a.file_id = b.file_id(+)
      and ceil( blocks*&&blksize/1024/1024) -
          ceil( (nvl(hwm,1)*&&blksize)/1024/1024 ) > 0
    /

    But some patients become confused when trying to purchase remedies from the Web because they don’t know what is obtainable. However, there are online pharmacy where you can order medications without a hitch. Many consumers view about getting information about levitra. Of course there are also other significant questions. Cialis is a cost effective medication for helping men to sustain an erection. Most likely cialis generic is an extremely complicated question. If you have any questions about tadalafil online, check with your doc before taking the drug. Many men take more medicaments later in being and some have sexual side effects that will lead to impotence. Some of medicaments fuel desire. Do not give Cialis or any remedy to anyone under 18 years old without prescription.

  • 转移 Oracle 的表空间

    1.将表空间置于只读

    只读状态可以使数据仍然可为用户访问.

    alter tablespace tablespace_name read only;

    2.物理拷贝文件

    3.将表空间offline

    alter tablespace tablespace_name offline;

    4.rename数据文件

    alter database rename file 'old_dir_file' to 'new_dir_file';

    5.将表空间联机

    alter tablespace tablespace_name online;

    6.将表空间置于read write模式

    alter tablespace tablespace_name read write;

    But some patients become confused when tight to purchase remedies from the Web because they don’t know what is obtainable. However, there are online pharmacy where you can order medications without a hitch. Many consumers view about getting information about levitra. Of course there are also other significant questions. Cialis is a cost efficient therapy for helping men to sustain an erection. Most likely cialis generic is an extremely complicated matter. If you have any questions about tadalafil online, check with your physician before grab the drug. Many people take more medicaments later in existence and some have sexual side effects that will lead to impotence. Some of medicaments fuel wish. Do not give Cialis or any remedy to anyone under 18 years old without prescription.

  • 转移 Oracle 的TEMP表空间

    Create tablespace TEMP2
    datafile '/data1/ora9data/temp2_01.dbf' 
    size 100k TEMPORARY;

    Tablespace created.

    alter database default temporary tablespace TEMP2;

    Database altered.

    drop tablespace temp including contents and datafiles;

    Tablespace dropped.