如有转载,请注明出处:http://blog.csdn.net/embedded_sky
作者:super_bert@csdn
1.安装包位置/home/forms/tools/db2_v101_linuxia32_expc.tar
2.解压安装包,使用root用户进入expc目录
3.执行setenforce 0 #关闭linux的安全检测
4.执行 ./db2_install
6.#创建用户组及用户
groupadd -g 2000 db2iadm1
useradd -m -g db2iadm1 -d /home/db2inst1 db2inst1
passwd db2inst1
这个时候我们创建了 db2iadm1 用户组 以及 一个 用户名和密码都是db2inst1 的用户。
/opt/ibm/db2/V10.1/instance/db2icrt -a server -u db2inst1 db2inst1
DBI1070I Program db2icrt completed successfully.
/opt/ibm/db2/V10.1/adm/db2licm -a ./db2/license/db2expc_uw.lic
LIC1402I License added successfully.
/opt/ibm/db2/V10.1/cfg/db2ln
10.#添加DB2端口
db2inst 50000/tcp
11.#DB2 配置
$ db2set DB2_EXTENDED_OPTIMIZATION=ON
$ db2set DB2_DISABLE_FLUSH_LOG=ON
$ db2set AUTOSTART=YES
$ db2set DB2_STRIPED_CONTAINERS=ON
$ db2set DB2_HASH_JOIN=Y
$ db2set DB2COMM=tcpip
$ db2set DB2_PARALLEL_IO=*
$ db2set DB2CODEPAGE=819
#Update dbm cfg
#TCP/IP Service name
$ db2 update dbm cfg using SVCENAME db2inst
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
$ db2 update dbm cfg using INDEXREC ACCESS
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
#运行DB2
必须先运行DB2才能创建数据库,否则报如下错误
SQL1032N No start database manager command was issued. SQLSTATE=57019
13.$ db2start
SQL1063N DB2START processing was successful.
#创建库
$ db2 "CREATE DATABASE DCDDB1 ALIAS DCDDB1 USING CODESET ISO8859-1 TERRITORY US"
DB20000I The CREATE DATABASE command completed successfully.
$ db2 connect to DCDDB1
Database Connection Information
$ db2 "CREATE table mytable ( col1 INTEGER NOT NULL, col2 VARCHAR(40), col3 DECIMAL(9,2))"
DB20000I The SQL command completed successfully.
$ db2 "SELECT * FROM mytable FETCH FIRST 10 ROWS ONLY"