安装过oracle数据库的都知道,oracle安装还是比较麻烦的,但是相应的资料也比较多,最近想重新系统的学习DB2,就免不了搭个环境练习练习。
简要的安装步骤如下,供参考。
一:安装配置环境
操作系统版本: Red Hat Enterprise Linux Server release 6.5 (Santiago)
数据库版本: DB2/LINUXX8664 11.1.2.2
[root@host02 ~]# uname -r
2.6.32-431.el6.x86_64
二:安装软件及创建数据库
1.上传v11.1_linuxx64_server_t.tar.gz到主机上
2.解压 tar -xzvf v11.1_linuxx64_server_t.tar.gz
会生成一个server_t文件。
3.安装前检查:
/u01/server_t
[root@host02 server_t]# ./db2prereqcheck
Validating "/lib/libpam.so*" ...
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*".
WARNING : Requirement not matched.
Requirement not matched for DB2 database "Server" with pureScale feature . Version: "9.8.0.2".
Summary of prerequisites that are not met on the current system:
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*".
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "libstdc++.so.5".
在检查是会出现以上错误。
上述报错IBM 给出了如下解释:
DBT3514W
The db2prereqcheck utility failed to find the following 32-bit library file: library-file-name.
Explanation
You can verify installation prerequisites for DB2 database using the db2prereqcheck utility.
This message is returned when the db2prereqcheck utility cannot find the 32-bit version of a required library file. If the named file is missing, 32-bit database applications might not function properly.
User response
Respond to this message in one of the following ways:
1> If you do not intend to use 32-bit applications with DB2 database, then no response is required.
2> If you do intend to use 32-bit applications with DB2 database, ensure that the named 32-bit library file exists on the system before installing DB2 database.
目前平台不打算使用32bit applications,故可以忽略以上警告信息。
4.安装软件
[root@host02 server_t]# ls
db2 db2checkCOL_readme.txt db2checkCOL.tar.gz db2ckupgrade db2_deinstall db2_install db2ls db2prereqcheck db2setup ibm_im installFixPack nlpack
[root@host02 server_t]# ./db2_install
…….
Install into default directory (/opt/ibm/db2/V10.5) ? [yes/no] -------------------- 这里选择安装目录,选择推荐目录即可(可以修改目录,如果不修改/预留大小为6G)
Yes
Enter "help" to redisplay product names. --------------- 选择安装产品类型,这里选择SERVER
Do you want to install the DB2 pureScale Feature? [yes/no] ---------------- 选择是否安装pureScale功能,这里选择不安装
生成如下目录
/opt/ibm/db2/V11.1
5. 配置DB2 Instance
创建用户和组
用户用途 用户名 用户组
实例所有者 db2inst1 db2iadm1
受防护的用户 db2fenc1 db2fadm1
DB2 管理服务器用户 dasusr1 dasadm1注:实例所有者主目录是将在其中创建DB2实例的位置;受防护的用户用于在DB2数据库所使用的地址空间之外运行用户定义的函数(UDF)和存储过程;DB2管理服务器用户的用户标识用于在系统上运行DB2管理服务器。
root@host02 ~]# groupadd db2iadm1
[root@host02 ~]# groupadd db2fadm1
[root@host02 ~]# groupadd dasadm1
[root@host02 ~]# useradd -u 600 -g db2iadm1 -m -d /home/db2inst1 db2inst1
[root@host02 ~]# useradd -u 601 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1
[root@host02 ~]# useradd -u 602 -g dasadm1 -m -d /home/dasusr1 dasusr1
创建DAS
/opt/ibm/db2/V11.1/instance
[root@host02 instance]# ./dascrt -u dasusr1
创建DB2 Instance
[root@host02 instance]# ./db2icrt -u db2fenc1 db2inst1
DBI1446I The db2icrt command is running
6.配置DB2服务器的TCP/IP通信
[root@host02 ~]# su - db2inst1
[db2inst1@host02 ~]$ db2set -all
[i] DB2AUTOSTART=NO
[g] DB2SYSTEM=host02
[g] DB2INSTDEF=db2inst1
[g] DB2ADMINSERVER=dasusr1
[db2inst1@host02 ~]$ db2set DB2COMM=tcpip
[db2inst1@host02 ~]$ db2set -all
更新服务器上services文件
cat /etc/services |grep DB2
更新服务器数据库管理文件
db2 update dbm cfg using SVCENAME 60006
[db2inst1@host02 ~]$ netstat -an |grep 60006
tcp 0 0 0.0.0.0:60006 0.0.0.0:* LISTEN
7.创建数据库
[db2inst1@host02 ~]$ db2 create db erpdb using codeset UTF-8 territory CN pagesize 8192
DB20000I The CREATE DATABASE command completed successfully.
到这DB2 就安装完成。看起来还是比oracle安装步骤简单。