DB2数据库安装
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
建用户
# groupadd db2iadm1
# useradd -m -g db2iadm1 -d /home/db2inst1 db2inst1
# groupadd db2fadm1
# useradd -m -g db2fadm1 -d /home/db2fenc1 db2fenc1
# groupadd dasadm1
# useradd -m -g dasadm1 -d /home/dasusr1 dasusr1
一、下载安装DB2
到IBM网站下载免费的DB2 Express-C 9.5,网址/developerworks/cn/downloads/im/udbexp/
下载db2exc_952_LNX_x86.tar.gz到/home/hz
使用 tar -xvf db2exc_952_LNX_x86.tar.gz命令解压,
解压到/home/hz/expc/目录下,
X/home/hz/expc/db2setup,命令行终端使用/home/hz/expc/db2_install来进行DB2的安装。
安装时若提示找不到libaio.so.1及libstdc++.so.5,则先下载安装相应的软件包。
libaio.so.1 -> libaio1
# aptitude install libaio1
libstdc++.so.5 -> libstdc++5
# aptitude install libstdc++5
二、配置DB2
#创建用户组及用户
#与实例名同名?
groupadd -g 2000 db2iadm1
useradd -m -g db2iadm1 -d /home/db2inst1 db2inst1
passwd db2inst1
>db2inst1
#the user under which fenced UDFs and fenced stored procedures will be run.
#可以与上面同一个用户
groupadd -g 2100 db2fadm1
useradd -m -g db2fadm1 -d /home/db2fenc1 db2fenc1
#创建实例
/opt/ibm/db2/V9.5/instance/db2icrt -a server -u db2fenc1 db2inst1
DBI1070I Program db2icrt completed successfully.
#产品许可证
/opt/ibm/db2/V9.5/adm/db2licm -a /home/hz/expc/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/V9.5/license/en_US .iso88591"
#允许SMS的多页分配
/opt/ibm/db2/V9.5/cfg/db2ln
#添加DB2端口
/etc/services 加入下面一行
#DB2 配置
su - 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
$ db2set DB2CODEPAGE=1386
#Update dbm cfg
#TCP/IP Service name
$ db2 update dbm cfg using SVCENAME db2inst
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed successfully.
$ 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
$ db2start
SQL1063N DB2START processing was successful.
#创建库
$ db2 "CREATE DATABASE GMCCDB ALIAS GMCCDB USING CODESET gb2312 TERRITORY CN"