首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 數據庫知識 >  >> DB2 資料庫 >> DB2 教學

Red Hat 7.3 上安裝 DB2 PE 7.2 完整記錄與避坑指南

     編輯:DB2 教學

前置準備

  • OS:Red Hat 7.3(需 pdksh*.rpm,從安裝光碟 /Packages/RPMS/ 安裝)
  • 用戶:db2inst1、db2fenc1、db2as
  • Shell 必須改為 ksh:chsh -s /bin/ksh db2inst1
  • 環境變數 .bash_profile 設定錯誤範例(勿直接用):
    export DB2DIR=/usr/IBMdb2/V7.1
    export PATH=$PATH:$DB2DIR/bin

安裝步驟

  1. ./db2setup 圖形化安裝,設定 DB2SYSTEM=test,安裝路徑 /usr/IBMdb2
  2. 安裝後配置:
    /usr/IBMdb2/V7.1/instance/db2icrt -a SERVER -u db2fenc1 db2inst1
    /usr/IBMdb2/V7.1/instance/dasicrt db2as
    /usr/IBMdb2/V7.1/adm/db2licm -a /cdrom/db2/license/db2udbpe.lic
    /usr/IBMdb2/V7.1/cfg/db2ln

關鍵錯誤與解決

db2icrt 警告:無法修改 .profile

DBI1768W Unable to modify the .profile or the .login file of user db2inst1.
Explanation: ... Without the modification you need to set your environment manually ...
User Response: Add the following line to the .profile file:
. sqllib/db2profile   # for ksh/sh
source sqllib/db2cshrc # for csh

解決:手動編輯 /home/db2inst1/.profile 加入 . /home/db2inst1/sqllib/db2profile。

驗證安裝

su - db2inst1
. sqllib/db2profile
db2sampl
db2 connect to sample
db2 "select * from staff where dept = 20"
db2 connect reset

停止服務

su - db2inst1; db2stop
su - db2as; db2admin stop

經驗總結

  • Linux 下 DB2 實例用戶 必須使用 ksh,否則環境腳本不相容。
  • db2setup 圖形介面需 X Window,純文字模式可用 db2_install。
  • 授權檔 db2udbpe.lic 必須在 db2licm -a 註冊。
  • 安裝日誌 /tmp/db2setup.log 記錄詳細過程,排查首選。
  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved