Linux环境安装DB2 V10.1

如有转载,请注明出处: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 的用户。
7.#创建实例

/opt/ibm/db2/V10.1/instance/db2icrt -a server -u  db2inst1 db2inst1
DBI1070I Program db2icrt completed successfully.
8.#产品许可证

/opt/ibm/db2/V10.1/adm/db2licm -a  ./db2/license/db2expc_uw.lic
LIC1402I License added successfully.
LIC1426I This product is now licensed for use as outlined in your License Agree
ment. USE OF THE PRODUCT CONSTITUTES ACCEPTANCE OF THE TERMS OF THE IBM LICENSE
AGREEMENT, LOCATED IN THE FOLLOWING DIRECTORY: "/opt/ibm/db2/V10.1/license/en_US
.iso88591"
9.#允许SMS的多页分配

/opt/ibm/db2/V10.1/cfg/db2ln
10.#添加DB2端口
在文件 /etc/services 加入下面一行

db2inst  50000/tcp
11.#DB2 配置
su - db2inst1
下面都是以 用户db2inst1 来运行了
$ 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
successfully.
12.

$ db2 update dbm cfg using INDEXREC ACCESS
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
successfully.

#运行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
Database server        = DB2/LINUX 10.1
SQL authorization ID   = DB2INST1
Local database alias   = DCDDB1
$ 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"


你可能感兴趣的:(IBM,DB2)