暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

CENTOS安装DB2 V10.5.X版本单实例数据库

博森瑞 2021-06-24
2349

    DB2作为世界上著名的关系型数据库之一,在金融、银行、保险等领域被广泛运用。原来在没有PC-SERVER移植化之前,他都是在IBM OS/390、AS400、RS6000等服务器上预装的。不过随着开源化的快速蔓延,很多公司都在开始去IOE(IBM/ORACLE/EMC),而DB2也从原来只能在IBM POWER架构服务器上被移植到PC-SERVE-LINUX服务器上。而DB2的整体安装过程比较复杂。坑比较多。不如ORACLE和MYSQL安起来那么简易。所以,我特地写了这篇文档帮助大家如何成功的在LINUX上安装DB2。

 

1.安装配置环境

操作系统版本: CENTOS 6.6 数据库版本: DB2/LINUXX8664 10.5.3

[root@bsr ~]# uname -a

Linux bsr 2.6.32-504.el6.x86_64 #1 SMP WedOct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

 

[root@bsr ~]# uname -r

2.6.32-504.el6.x86_64

 

[root@bsr ~]# cat etc/redhat-release

CentOS release 6.6 (Final)

 

2.安装数据库软件

2.1 上传安装软件和license文件到某文件夹

[root@bsr ~]# cd /software/

[root@bsr software]# ls -l

total 1359328

drwxrwxrwx. 6 bsr bsr       4096 Jun 9 05:05 aese_c

-rwxrwxrwx. 1 bsr bsr 1391968725 Jun  9 05:05 DB2_Svr_10.5.0.3_Linux_x86-64.tar.gz

 

2.2 解压缩安装包

 

这里省略

 

2.3 安装前预检测

 

上述解压过后得到文件如下:

[root@bsr software]# ls -l

 

drwxr-xr-x. 5 root   root        4096 Feb  7 08:33 server

 

[root@bsr software]# cd server/

 

[root@bsr server]# ls

db2 db2checkCOL_readme.txt db2checkCOL.tar.gz db2ckupgrade  db2_deinstall  db2_install db2ls  db2prereqcheck  db2setup ibm_im  installFixPack  nlpack

 

[root@bsr server]# ./db2prereqcheck -v10.5.1 -s -o /tmp/db_check.log

Requirement not matched for DB2 database"Server" . Version: "10.5.0.3".

Summary of prerequisites that are not meton the current system:    DBT3514W  The db2prereqcheck utility failed to find thefollowing 32-bit library file: "/lib/libpam.so*".

 

DBT3514W The db2prereqcheck utility failed to find the following 32-bit libraryfile: "libstdc++.so.6".

 

 

Requirement not matched for DB2 database"Server" with pureScale feature. Version: "10.5.0.3".

Summary of prerequisites that are not meton the current system:    DBT3514W  The db2prereqcheck utility failed to find thefollowing 32-bit library file: "/lib/libpam.so*".

 

DBT3588W The db2prereqcheck utility was unable to validate the configuration ofthe log_mtts_per_seg parameter on the following host machine: "bsr".Reason code: "1".

 

DBT3566E The db2prereqcheck utility detected that the service named"rdma" is not enabled on host "bsr".

 

DBT3514W The db2prereqcheck utility failed to find the following 32-bit libraryfile: "libstdc++.so.6".

 

DBT3563E The db2prereqcheck utility determined that SELinux is enabled, which isnot supported with GPFS.

 

上述报错IBM 给出了如下解释:

 

DBT3514W

The db2prereqcheck utility failed to findthe following 32-bit library file: library-file-name.

Explanation

You can verify installation prerequisitesfor DB2 database using the db2prereqcheck utility.

This message is returned when thedb2prereqcheck utility cannot find the 32-bit version of a required libraryfile. If the named file is missing, 32-bit database applications might notfunction properly.

User response

Respond to this message in one of thefollowing ways:

1> If you do not intend to use 32-bitapplications with DB2 database, then no response is required.

2> If you do intend to use 32-bitapplications with DB2 database, ensure that the named 32-bit library fileexists on the system before installing DB2 database.

 

目前平台不打算使用32bit applications,故可以忽略以上警告信息。

 

2.4 采用命令行来安装数据库软件

[root@bsr server]# ./db2_install

Requirement not matched for DB2 database"Server" . Version: "10.5.0.3".

Summary of prerequisites that are not meton the current system:

  DBT3514W  The db2prereqcheckutility failed to find the following 32-bit library file:"/lib/libpam.so*".

 

 

DBT3514W The db2prereqcheck utility failed to find the following 32-bit libraryfile: "libstdc++.so.6".

 

 

DBI1324W Support of the db2_install command is deprecated. For

     more information, see the DB2 Information Center.

 

 

 

Default directory for installation ofproducts - /opt/ibm/db2/V10.5

 

***********************************************************

Install into default directory(/opt/ibm/db2/V10.5) ? [yes/no] -------------------- 这里选择安装目录,选择推荐目录即可

yes

 

 

Specify one of the following keywords toinstall DB2 products.

 

 SERVER

 CONSV

  EXP

 CLIENT

 RTCL

 

Enter "help" to redisplay productnames.                   --------------- 选择安装产品类型,这里选择SERVER

 

Enter "quit" to exit.

 

***********************************************************

SERVER

***********************************************************

Do you want to install the DB2 pureScaleFeature? [yes/no]   ---------------- 选择是否安装pureScale功能,这里选择不安装

no

Requirement not matched for DB2 database"Server" . Version: "10.5.0.3".

Summary of prerequisites that are not meton the current system:

  DBT3514W  The db2prereqcheckutility failed to find the following 32-bit library file:"/lib/libpam.so*".

 

 

DBT3514W The db2prereqcheck utility failed to find the following 32-bit libraryfile: "libstdc++.so.6".

 

 

DB2 installation is being initialized.

 

 Total number of tasks to be performed: 48

Total estimated time for all tasks to beperformed: 1873 second(s)

 

Task #1 start

Description: Checking license agreementacceptance

Estimated time 1 second(s)

Task #1 end

...................................................................................................................

...................................................................................................................

Task #50 start

Description: Updating global profileregistry

Estimated time 3 second(s)

Task #50 end

 

The execution completed successfully.

 

For more information see the DB2installation log at

"/tmp/db2_install.log.2881".

 

2.5 注册liences (这一步得你需要有liences如果你是小型机的话,一般都是随机附送的,如果你是pc-sever需要购买。不过研究是够用了)

[root@bsr adm]#/opt/ibm/db2/V10.5/adm/db2licm -l

Product name:                     "DB2 EnterpriseServer Edition"

License type:                     "License not registered"

Expiry date:                      "License notregistered"

Product identifier:               "db2ese"

Version information:              "10.5"

[root@bsr adm]# cd/software/aese_c/db2/license --这个步骤你要是没有注册文件的话忽略,一般公司都买了不用担心

[root@bsr license]# ls

db2aese_c.lic  sam32.lic UNIX  Windows

[root@bsr license]#/opt/ibm/db2/V10.5/adm/db2licm -a db2aese_c.lic

 

LIC1402I License added successfully.

 

 

LIC1426I This product is now licensed for use as outlined in your LicenseAgreement.  USE OF THE PRODUCTCONSTITUTES ACCEPTANCE OF THE TERMS OF THE IBM LICENSE AGREEMENT, LOCATED INTHE FOLLOWING DIRECTORY: "/opt/ibm/db2/V10.5/license/en_US.iso88591"

[root@bsr license]#/opt/ibm/db2/V10.5/adm/db2licm -l

Product name:                     "DB2 AdvancedEnterprise Server Edition"

License type:                     "CPU Option"

Expiry date:                      "Permanent"

Product identifier:               "db2aese"

Version information:              "10.5"

Enforcement policy:               "Soft Stop"

 

3.配置DB2 Instance

3.1 创建用户和组

用户用途用户名 用户组

实例所有者 db2inst1 db2iadm1

受防护的用户 db2fenc1 db2fadm1

DB2 管理服务器用户 dasusr1dasadm1

注:实例所有者主目录是将在其中创建DB2实例的位置;受防护的用户用于在DB2数据库所使用的地址空间之外运行用户定义的函数(UDF)和存储过程;DB2管理服务器用户的用户标识用于在系统上运行DB2管理服务器。

groupadd -g 999 db2iadm1

groupadd -g 998 db2fadm1

groupadd -g 997 dasadm1

useradd -u 600 -g db2iadm1 -m -d/home/db2inst1 db2inst1

useradd -u 601 -g db2fadm1 -m -d/home/db2fenc1 db2fenc1

useradd -u 602 -g dasadm1 -m -d/home/dasusr1 dasusr1

passwd db2inst1

Changing password for user db2inst1.

New password:

BAD PASSWORD: it is based on a dictionaryword

Retype new password:

passwd: all authentication tokens updatedsuccessfully.

[root@bsr ~]# passwd db2fenc1

Changing password for user db2fenc1.

New password:

BAD PASSWORD: it is based on a dictionaryword

Retype new password:

passwd: all authentication tokens updatedsuccessfully.

[root@bsr ~]# passwd dasusr1

Changing password for user dasusr1.

New password:

BAD PASSWORD: it is based on a dictionaryword

Retype new password:

passwd: all authentication tokens updatedsuccessfully.

 

3.2 创建DAS

[root@bsr ~]# cd/opt/ibm/db2/V10.5/instance/

[root@bsr instance]# ./dascrt -u dasusr1

DBI1070I Program dascrt completed successfully.

 

注:版本9.7中已经不推荐使用“DB2 管理服务器(DAS)”,在以后的发行版中可能会将其除去。DASDB2 pureScale环境中不受支持。

 

 

3.3 创建DB2 Instance(下面的过程为新建实例等过程了。请参照其它文档或者参照你公司的安装规范!)

 

更改环境变量

vi /etc/profile

export DB2_HOME=/opt/ibm/db2/V10.5/instance

export PATH=$PATH:$DB2_HOME

 

执行source /etc/profile命令,生成环境变量

 

[root@bsr instance]# ./db2icrt -u db2fenc1db2inst1

DBI1446I The db2icrt command is running.

 

 

DB2 installation is being initialized.

 

 Total number of tasks to be performed: 4

Total estimated time for all tasks to beperformed: 309 second(s)

.......................................................................................................

.......................................................................................................

Task #4 start

Description: Updating global profileregistry

Estimated time 3 second(s)

Task #4 end

 

The execution completed successfully.

 

For more information see the DB2installation log at "/tmp/db2icrt.log.8120".

Required: Review the following log filealso for warnings or errors:

"/tmp/db2icrt_local.log.*"

DBI1070I Program db2icrt completed successfully.

 

 

[db2inst1@bsr ~]$ db2ilist

db2inst1

 

4.配置DB2服务器的TCP/IP通信

4.1 设置DB2服务器的通信协议

[root@bsr ~]# su - db2inst1

[db2inst1@bsr ~]$ db2set -all

[i] DB2AUTOSTART=NO

[g] DB2SYSTEM=bsr

[g] DB2INSTDEF=db2inst1

[g] DB2ADMINSERVER=dasusr1

[db2inst1@bsr ~]$ db2set DB2COMM=tcpip

[db2inst1@bsr ~]$ db2set -all

[i] DB2COMM=TCPIP

[i] DB2AUTOSTART=NO

[g] DB2SYSTEM=bsr

[g] DB2INSTDEF=db2inst1

[g] DB2ADMINSERVER=dasusr1

 

4.2 更新服务器上services文件

[db2inst1@bsr ~]$ cat /etc/services |grepDB2

ibm-db2         523/tcp                 # IBM-DB2

ibm-db2         523/udp                 # IBM-DB2

questdb2-lnchr  5677/tcp                # Quest Central DB2 Launchr

questdb2-lnchr  5677/udp                # Quest Central DB2 Launchr

DB2_db2inst1    60006/tcp              # DB2 连接服务端口

DB2_db2inst1_1  60007/tcp

DB2_db2inst1_2  60008/tcp

DB2_db2inst1_3  60009/tcp

DB2_db2inst1_4  60010/tcp

DB2_db2inst1_END        60011/tcp

 

4.3 更新服务器数据库管理文件

[db2inst1@bsr ~]$ db2 get dbm cfg |grepSVCENAME

 TCP/IP Service name                          (SVCENAME) =

 SSLservice name                        (SSL_SVCENAME) =

[db2inst1@bsr ~]$ db2 update dbm cfg usingSVCENAME 60006

DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed

successfully.

[db2inst1@bsr ~]$ db2 get dbm cfg |grepSVCENAME

 TCP/IP Service name                          (SVCENAME) = 60006

 SSLservice name                        (SSL_SVCENAME) =

 

4.4 验证通信端口状态

[db2inst1@bsr ~]$ db2start

06/09/2014 19:38:44     0  0   SQL1063N  DB2START processing was successful.

SQL1063N DB2START processing was successful.

[db2inst1@bsr ~]$ netstat -an |grep 60006

tcp       0      0 0.0.0.0:60006               0.0.0.0:*                   LISTEN

 

5. 创建数据库

[db2inst1@bsr ~]$ db2 create db shifo usingcodeset UTF-8 territory CN pagesize 8192

DB20000I The CREATE DATABASE command completed successfully.

[db2inst1@bsr ~]$ db2 connect to shifo

 

  Database Connection Information

 

 Database server        = DB2/LINUXX8664 10.5.3

 SQLauthorization ID   = DB2INST1

 Local database alias   = bsr

 

 

此文档安装DB2 V10.1.X也可以。


文章转载自博森瑞,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论