(http://publib.boulder.ibm.com/infoce...w/v8/index.jsp)
OS 安裝選用的套件
必要得套件安裝
編輯 /etc/sysctl.conf
fs.file-max = 8192 kernel.shmmax = 1073741824 kernel.shmall = 471859 kernel.msgmni = 4096 kernel.sem = 250 64000 32 2048 vm.lower_zone_protection = 250
註:kernel.shmax :for x86, here is 268435456 byte(256MB); for 64bit, here is 1073741824 byte(1GB)
kernel.shmall: physical memory(KB) * 90% / 4, 2048 * 1024 * 90% /4= 471859.2 , 請注意不可小於 Table 所需的 buffer pool的總值.
套用設定
#sysctl -p #ipcs -l ------ Shared Memory Limits -------- max number of segments = 4096 max seg size (kbytes) = 1048576 max total shared memory (kbytes) = 1887436 min seg size (bytes) = 1 ------ Semaphore Limits -------- max number of arrays = 2048 max semaphores per array = 250 max semaphores system wide = 64000 max ops per semop call = 32 semaphore max value = 32767 ------ Messages: Limits -------- max queues system wide = 4096 max size of message (bytes) = 8192 default max size of queue (bytes) = 16384
oom-kill 值修改為 0
#echo 0 > /proc/sys/vm/oom-kill
在 X Window 環境下安裝)
#tar xzf DB2_V82_ESE_LNX_AMD64_NLV.tar.gz #cd ese #db2setup
Install Products
> Installation Type: Typical
> Install DAS
> Set up a DB2 Instance: Do not create a DB2 Instance
> Set up the administration contact list
NOTE:
出現警告視窗:未指定 SMTP server
選擇 OK 繼續下一步驟
> Finish,開始安裝主程式
#tar xf FP18_MI00295.tar #cd FP18_MI00295 #mkdir db2fp18 #tar xf FP18_MI00295.tar -C db2fp18/ #cd db2fp18 #./installFixPak -y
重啟主機
新增 Instance 帳號/群組
#groupadd db2adm #useradd -g db2adm db2inst
編輯 /etc/services
# DB2_db2inst 60000/tcp DB2_db2inst_1 60001/tcp DB2_db2inst_2 60002/tcp DB2_db2inst_END 60003/tcp
新增 DB2 Instance
#cd /opt/IBM/db2/V8.1/instance/ #./db2icrt -s ese -u db2inst db2inst
未授權的訊息
#su - db2inst #db2licm -l Product Name = "DB2 Enterprise Server Edition" Product Identifier = "DB2ESE" Version Information = "8.2" Expiry Date = "11/06/2013 (Try & Buy)" Registered Connect User Policy = "Disabled" Number Of Entitled Connect Users = "5" Enforcement Policy = "Soft Stop" Number of processors = "1" Number of licensed processors = "1" Database partitioning feature = "Entitled" Annotation = "" Other information
軟體版本
#su - db2inst #db2level DB21085I Instance "db2inst" uses "32" bits and DB2 code release "SQL08029" with level identifier "030A0106". Informational tokens are "DB2 v8.1.3.160", "s090715", "MI00295", and FixPak "18". Product is installed at "/opt/IBM/db2/V8.1". 註:雖然安裝的版本是 x86_64,而這裡顯示 "32"bits,這是正常的。
匯入授權檔
#su - db2inst #db2licm -a db2ese.lic
已授權的訊息
#db2licm -l Product Name = "DB2 Enterprise Server Edition" Product Identifier = "DB2ESE" Version Information = "8.2" Expiry Date = "Permanent" Registered Connect User Policy = "Disabled" Number Of Entitled Connect Users = "5" Enforcement Policy = "Soft Stop" Number of processors = "1" Number of licensed processors = "1" Database partitioning feature = "Not entitled" Annotation = "" Other information = ""
DB2 啟動及驗證
#su - db2inst #db2 "update dbm cfg using svcename DB2_db2inst" #db2set DB2COMM=tcpip #db2set DB2CODEPAGE=950 #db2set DB2AUTOSTART=NO #db2start #ps -ef | grep db2sysc
TIPs:
第一次啟動 DB2 必須加上 db2set 的一些參數
如果有正常啟動,執行 netstat -lt 檢查
參數的預設值太小,這會影響到 DB 平時運作以及 import 的操作
$> db2 "get db cfg"
DB 參數名稱
Log file size (4KB) (LOGFILSIZ) = 20480 Number of primary log files (LOGPRIMARY) = 20 Number of secondary log files (LOGSECOND) = 25 Changed path to log files (NEWLOGPATH) = Path to log files = /home/devmm/DEVMMDB/devmm/NODE0000/SQL00001/SQLOGDIR Block log on disk full (BLK_LOG_DSK_FUL) = YES
TIPs:
20480 x 4KB x (20+25) = 3600MB
Making sure the filesystem of traction log('Path to log files') has sufficient available space.
mkdir /home/devmm/DEVMMDB/log db2 "update db cfg for DEVMMDB using LOGFILSIZ 12800" db2 "update db cfg for DEVMMDB using LOGPRIMARY 10" db2 "update db cfg for DEVMMDB using LOGSECOND 10" db2 "update db cfg for DEVMMDB using NEWLOGPATH /home/devmm/DEVMMDB/log" db2 "update db cfg for DEVMMDB using BLK_LOG_DSK_FUL YES"