Ubuntu 8.04下安裝DB2方法

來源:互聯網
上載者:User

 參考文獻:

How-to: Ubuntu 7.10 Server x86 32-bit and DB2 Express-C v9.5

DB2 v9.7 Infomation Center

 

情境:在IBM System x3550伺服器上,Ubuntu Server 8.0.4作業系統中以db2_install 命令安裝DB2 v9.7 ESE trial資料庫。

 

一.安裝前的步驟

    1.安裝幾個包,執行命令:

        sudo apt-get install libaio1
        sudo apt-get install libstdc++5

 

    2.copy安裝檔案到目標系統,並解壓縮。如果是從windwos解壓縮完再傳到Ubuntu上,那麼需要設定安裝檔案及相關的檔案以可執行屬性。

 

    3.設定ulimit(Server版這步就略過了)

 

    4.修改核心參數

        1)查看核心參數

            ipcs -l

            顯示如下:

cuser@localhost:~$ ipcs -l ------ Shared Memory Limits -------- max number of segments = 4096 max seg size (kbytes) = 32768 max total shared memory (kbytes) = 8388608 min seg size (bytes) = 1 ------ Semaphore Limits -------- max number of arrays = 128 max semaphores per array = 250 max semaphores system wide = 32000 max ops per semop call = 32 semaphore max value = 32767 ------ Messages: Limits -------- max queues system wide = 16 max size of message (bytes) = 8192 default max size of queue (bytes) = 16384

 

        2)編輯/etc/sysctl.conf檔案。如果此檔案不存在,那麼應建立它。加入如下內容:

kernel.sem=250 256000 32 1024 #樣本:用於 64 位元系統的 shmmax kernel.shmmax=1073741824 #樣本:用於4GB記憶體的 90% 的 shmall kernel.shmall=943718 kernel.msgmax=65535 kernel.msgmnb=65535  

            對於這些參數的說明,參考DB2 infocenter:

  建議將 SHMMAX 值設定為與系統上實體記憶體量相等。然而,x86 系統上需要的最小值為 268435456(256 MB),而在 64 位元系統上,該值將為 1073741824(1 GB)。
  預設情況下,SHMALL 設定為 8 GB(8388608 KB = 8 GB)。如果您具有的實體記憶體超過此值,並且要將該實體記憶體用於 DB2,那麼此參數增大到大約是電腦的實體記憶體的 90%。例如,假定電腦系統上有 16 GB 記憶體,並將這些記憶體主要用於 DB2,那麼 SHMALL 應該設定為 3774873(16 GB 的 90% 為 14.4 GB;將 14.4 GB 除以 4 KB(這是基頁大小)得到的結果為 3774873)。IPCS 輸出已將 SHMALL 轉換為KB(KB)。這是因為核心需要將此值作為頁數。如果要升級到 DB2 版本 9.7 並且沒有使用預設 SHMALL 設定,那麼必須將 SHMALL 設定另外增大 4 GB。快速通訊管理器(FCM)要求這樣增大記憶體,以供另外的緩衝區或通道使用。
  核心參數 sem 由以下四個標記組成:SEMMSL、SEMMNS、SEMOPM 和 SEMMNI。SEMMNS 是 SEMMSL 乘以 SEMMNI 的結果。資料庫管理員要求根據需要增大數組的數目(SEMMNI)。通常,SEMMNI 應兩倍於系統上預期的最大代理程式數乘以資料庫伺服器電腦上的邏輯分區數再加上資料庫伺服器電腦上的本地應用程式串連數。
  MSGMNI 將影響可以啟動的代理進程數,MSGMAX 將影響一個隊列中可以發送的訊息大小,而 MSGMNB 將影響隊列大小。
  應將 MSGMAX 更改為 64 KB(即,65535 個位元組),MSGMNB 應增大為 65535。

 

        3)運行sysctl 時附帶-p參數,以從預設檔案/etc/sysctl.conf中裝入sysctl設定:

            sudo sysctl -p

 

二.安裝資料庫

    1.運行安裝命令

        sudo ./db2_install

    2.指定安裝路徑,一般不更改路徑,英文環境鍵入“no”加斷行符號,中文環境鍵入“否”加斷行符號。

    3.選擇安裝產品,這裡我選ESE,然後斷行符號。

    4.一路安裝,末了提示一個警告,說有小錯誤,不去管它,算是安裝完。

 

三.安裝後步驟

    1.建立使用者和使用者組

        1)建立使用者組:

            sudo groupadd -g 999 db2iadm1
            sudo groupadd -g 998 db2fadm1
            sudo groupadd -g 997 dasadm1
        2)建立使用者:
            sudo useradd -u 1004 -g db2iadm1 -m -d /home/db2inst1 db2inst1
            sudo useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1
            sudo useradd -u 1002 -g dasadm1 -m -d /home/dasusr1 dasusr1
        3)設定使用者的密碼
            sudo passwd db2inst1
            sudo passwd db2fenc1
            sudo passwd dasusr1

 

    2.建立DB2管理服務
            sudo /opt/ibm/db2/V9.7/instance/dascrt -u dasusr1

    3.建立DB2執行個體
            sudo /opt/ibm/db2/V9.7/instance/db2icrt -a server -u db2fenc1 db2inst1

    4.設定DB2使用的連接埠
            su - db2inst1
            /bin/bash
            chsh -s /bin/bash db2inst1(DB2需要bash,這個命令修改預設的sh)

            /home/db2inst1/sqllib/db2profile

            db2 update dbm cfg using svcename 50000

 

    5.設定DB2通訊協議
            db2set DB2COMM=tcpip


    6.啟動DB2
            db2start

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.