linux_DB2安装

1.操作系统   : SELinux6.5_64_bit

2.DB2安装包:Db2_10.5_64_bit

3. 安装文件所在目录:

     (1).F:\资源\安装包\db2_10.5

      (2)  . operating system image file :

        F:\资源\安装包\linux6.6_64位

3.DB2安装教程:

          http://www.ibmdba.com/?p=230

 

------------------------------------------------------------

Install DB2 10.5 on Redhat Linux 6.5 for x86_64

By admin - Last updated: Tuesday, June 10, 2014 - Save & Share - Leave a Comment

Install DB2 10.5 on Redhat Linux 6.5 for x86_64
近期发现在互联网上关于DB2 10.5的安装资料还是很少,如是打算发一篇关于DB2 10.5在Redhat Linux 6.5上安装的步骤,其实其安装和DB2以前的安装过程类似,简要的安装步骤如下,供参考。
1.安装配置环境
操作系统版本: Red Hat Enterprise Linux Server release 6.5 (Santiago) 数据库版本: DB2/LINUXX8664 10.5.3

[root@xuhz ~]# uname -a
Linux xuhz 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@xuhz ~]# uname -r
2.6.32-431.el6.x86_64
[root@xuhz ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.5 (Santiago)

2.安装数据库软件
2.1 上传安装软件和license文件到某文件夹

[root@xuhz ~]# cd /software/
[root@xuhz software]# ls -l
total 1359328
drwxrwxrwx. 6 honcho honcho       4096 Jun  9 05:05 aese_c
-rwxrwxrwx. 1 honcho honcho 1391940725 Jun  9 05:05 DB2_Svr_10.5.0.3_Linux_x86-64PVU.tar.gz

2.2 解压缩安装包

[root@xuhz software]# gunzip DB2_Svr_10.5.0.3_Linux_x86-64PVU.tar.gz
[root@xuhz software]# tar -xvf DB2_Svr_10.5.0.3_Linux_x86-64PVU.tar

2.3 安装前预检测

[root@xuhz software]# ls -l
drwxrwxrwx. 6 honcho honcho       4096 Jun  9 05:05 aese_c
-rwxrwxrwx. 1 honcho honcho 1560576000 Jun  9 05:05 DB2_Svr_10.5.0.3_Linux_x86-64PVU.tar
drwxr-xr-x. 5 root   root         4096 Feb  7 08:33 server
[root@xuhz software]# cd server/
[root@xuhz server]# ls
db2  db2checkCOL_readme.txt  db2checkCOL.tar.gz  db2ckupgrade  db2_deinstall  db2_install  db2ls  db2prereqcheck  db2setup  ibm_im  installFixPack  nlpack
[root@xuhz server]# ./db2prereqcheck -v 10.5.0.3 -s -o /tmp/db_check.log
Requirement not matched for DB2 database "Server" . Version: "10.5.0.3". 
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.6". 


Requirement not matched for DB2 database "Server" with pureScale feature. Version: "10.5.0.3". 
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*". 

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

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

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

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

上述报错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,故可以忽略以上警告信息。

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

[root@xuhz server]# ./db2_install 
Requirement not matched for DB2 database "Server" . Version: "10.5.0.3". 
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.6". 


DBI1324W  Support of the db2_install command is deprecated. For
      more information, see the DB2 Information Center.


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

***********************************************************
Install into default directory (/opt/ibm/db2/V10.5) ? [yes/no] -------------------- 这里选择安装目录,选择推荐目录即可
yes
 
 
Specify one of the following keywords to install DB2 products.

  SERVER 
  CONSV 
  EXP 
  CLIENT 
  RTCL 
 
Enter "help" to redisplay product names.                   --------------- 选择安装产品类型,这里选择SERVER

Enter "quit" to exit.

***********************************************************
SERVER
***********************************************************
Do you want to install the DB2 pureScale Feature? [yes/no] 
   ---------------- 选择是否安装pureScale功能,这里选择不安装
no
Requirement not matched for DB2 database "Server" . Version: "10.5.0.3". 
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.6". 


DB2 installation is being initialized.

 Total number of tasks to be performed: 48 
Total estimated time for all tasks to be performed: 1873 second(s) 

Task #1 start
Description: Checking license agreement acceptance 
Estimated time 1 second(s) 
Task #1 end
...................................................................................................................
...................................................................................................................
Task #50 start
Description: Updating global profile registry 
Estimated time 3 second(s) 
Task #50 end 

The execution completed successfully.

For more information see the DB2 installation log at
"/tmp/db2_install.log.2881".

2.5 注册liences

[root@xuhz adm]# /opt/ibm/db2/V10.5/adm/db2licm -l
Product name:                     "DB2 Enterprise Server Edition"
License type:                     "License not registered"
Expiry date:                      "License not registered"
Product identifier:               "db2ese"
Version information:              "10.5"
[root@xuhz adm]# cd /software/aese_c/db2/license
[root@xuhz license]# ls
db2aese_c.lic  sam32.lic  UNIX  Windows
[root@xuhz 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 License Agreement.  USE OF THE PRODUCT CONSTITUTES ACCEPTANCE OF THE TERMS OF THE IBM LICENSE AGREEMENT, LOCATED IN THE FOLLOWING DIRECTORY: "/opt/ibm/db2/V10.5/license/en_US.iso88591"
[root@xuhz license]# /opt/ibm/db2/V10.5/adm/db2licm -l
Product name:                     "DB2 Advanced Enterprise 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 管理服务器用户 dasusr1 dasadm1
注:实例所有者主目录是将在其中创建DB2实例的位置;受防护的用户用于在DB2数据库所使用的地址空间之外运行用户定义的函数(UDF)和存储过程;DB2管理服务器用户的用户标识用于在系统上运行DB2管理服务器。

[root@xuhz ~]# groupadd -g 999 db2iadm1
[root@xuhz ~]# groupadd -g 998 db2fadm1
[root@xuhz ~]# groupadd -g 997 dasadm1
[root@xuhz ~]# useradd -u 600 -g db2iadm1 -m -d /home/db2inst1 db2inst1
[root@xuhz ~]# useradd -u 601 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1
[root@xuhz ~]# useradd -u 602 -g dasadm1 -m -d /home/dasusr1 dasusr1
[root@xuhz ~]# passwd db2inst1
Changing password for user db2inst1.
New password: 
BAD PASSWORD: it is based on a dictionary word
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@xuhz ~]# passwd db2fenc1
Changing password for user db2fenc1.
New password: 
BAD PASSWORD: it is based on a dictionary word
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@xuhz ~]# passwd dasusr1
Changing password for user dasusr1.
New password: 
BAD PASSWORD: it is based on a dictionary word
Retype new password: 
passwd: all authentication tokens updated successfully.

3.2 创建DAS

[root@xuhz ~]# cd /opt/ibm/db2/V10.5/instance/
[root@xuhz instance]# ./dascrt -u dasusr1
DBI1070I  Program dascrt completed successfully.

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

在这一步骤调用 db2irt 创建实例命令时候,可能出错,出错的原因是因为(adm目录中,有一些文件类型不是bin 类型的),他们不能被拷贝走,

cd ..

cd adm

ls -l

删除不是bin类型的文件后,在创建实例。

[root@xuhz instance]# ./db2icrt -u db2fenc1 entegor1
DBI1446I  The db2icrt command is running.
以entegor1用户创建成功后,再用entegor1 登录操作系统后,执行db2start 命令才能启动db2数据库。否则不能启动

DB2 installation is being initialized.

 Total number of tasks to be performed: 4 
Total estimated time for all tasks to be performed: 309 second(s)
.......................................................................................................
.......................................................................................................
Task #4 start
Description: Updating global profile registry 
Estimated time 3 second(s) 
Task #4 end 

The execution completed successfully.

For more information see the DB2 installation log at "/tmp/db2icrt.log.8120".
Required: Review the following log file also for warnings or errors:
"/tmp/db2icrt_local.log.*"
DBI1070I  Program db2icrt completed successfully.
[db2inst1@xuhz ~]$ db2ilist
db2inst1

4.配置DB2服务器的TCP/IP通信
4.1 设置DB2服务器的通信协议

[root@xuhz ~]# su - db2inst1
[db2inst1@xuhz ~]$ db2set -all
[i] DB2AUTOSTART=NO
[g] DB2SYSTEM=xuhz
[g] DB2INSTDEF=db2inst1
[g] DB2ADMINSERVER=dasusr1
[db2inst1@xuhz ~]$ db2set DB2COMM=tcpip
[db2inst1@xuhz ~]$ db2set -all
[i] DB2COMM=TCPIP
[i] DB2AUTOSTART=NO
[g] DB2SYSTEM=xuhz
[g] DB2INSTDEF=db2inst1
[g] DB2ADMINSERVER=dasusr1

4.2 更新服务器上services文件

[db2inst1@xuhz ~]$ cat /etc/services |grep DB2
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@xuhz ~]$ db2 get dbm cfg |grep SVCENAME
 TCP/IP Service name                          (SVCENAME) = 
 SSL service name                         (SSL_SVCENAME) = 
[db2inst1@xuhz ~]$ db2 update dbm cfg using SVCENAME 60006
DB20000I  The UPDATE DATABASE MANAGER CONFIGURATION command completed 
successfully.
[db2inst1@xuhz ~]$ db2 get dbm cfg |grep SVCENAME
 TCP/IP Service name                          (SVCENAME) = 60006
 SSL service name                         (SSL_SVCENAME) =

4.4 验证通信端口状态

[db2inst1@xuhz ~]$ db2start
06/09/2014 19:38:44     0   0   SQL1063N  DB2START processing was successful.
SQL1063N  DB2START processing was successful.
[db2inst1@xuhz ~]$ netstat -an |grep 60006
tcp        0      0 0.0.0.0:60006               0.0.0.0:*                   LISTEN

5. 创建数据库

[db2inst1@xuhz ~]$ db2 create db honcho using codeset UTF-8 territory CN pagesize 8192
DB20000I  The CREATE DATABASE command completed successfully.
[db2inst1@xuhz ~]$ db2 connect to honcho

   Database Connection Information

 Database server        = DB2/LINUXX8664 10.5.3
 SQL authorization ID   = DB2INST1
 Local database alias   = HONCHO

至此,DB2数据库软件安装和数据库实例及数据库创建完成,相比Oracle的安装而言DB2的安装步骤更加简单。

Posted in DB2, Upgrade and Migration • • Top Of Page

Write a comment

 

 

 

 

#=========中信V8 特殊设置,创建 entegor1 用户来安装实例==========

1.create user and userGroup,create 3 users with his Group.
 用户用途    用户名             用户组,
实例所有者    db2inst1    db2iadm1
受防护的用户    db2fenc1    db2fadm1
DB2管理服务器用户    dasusr1            dasadm1

2.create userGroup:
[root@xuhz ~]# groupadd -g 999 db2iadm1
[root@xuhz ~]# groupadd -g 998 db2fadm1
[root@xuhz ~]# groupadd -g 997 dasadm1

3.create user with hisgroup
[root@xuhz ~]# useradd -u 600 -g db2iadm1 -m -d /home/entegor1 entegor1
[root@xuhz ~]# useradd -u 601 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1
[root@xuhz ~]# useradd -u 602 -g dasadm1  -m -d /home/dasusr1 dasusr1
3.1 set new user's passwd:
#==============================all user password is "idealinfo"!!!!!!!!!!!!!!!!! ===============================================================
    [root@xuhz ~]# passwd entegor1
    Changing password for user entegor1.
    New password:
    BAD PASSWORD: it is based on a dictionary word
    Retype new password:
    passwd: all authentication tokens updated successfully.

    [root@xuhz ~]# passwd db2fenc1
    Changing password for user db2fenc1.
    New password:
    BAD PASSWORD: it is based on a dictionary word
    Retype new password:
    passwd: all authentication tokens updated successfully.

    [root@xuhz ~]# passwd dasusr1
    Changing password for user dasusr1.
    New password:
    BAD PASSWORD: it is based on a dictionary word
    Retype new password:
    passwd: all authentication tokens updated successfully.

3.2 创建DAS

[root@xuhz ~]# cd /opt/ibm/db2/V10.5/instance/
[root@xuhz instance]# ./dascrt -u dasusr1
DBI1070I  Program dascrt completed successfully.

3.3 创建DB2 Instance

在这一步骤调用 db2irt 创建实例命令时候,可能出错,出错的原因是因为(adm目录中,有一些文件类型不是bin 类型的),他们不能被拷贝走,

cd ..

cd adm

ls -l

删除不是bin类型的文件后,在创建实例。

[root@xuhz instance]# ./db2icrt -u db2fenc1 entegor1
DBI1446I  The db2icrt command is running.
以entegor1用户创建成功后,再用entegor1 登录操作系统后,执行db2start 命令才能启动db2数据库。否则不能启动


    [db2inst1@xuhz ~]$ db2ilist
    db2inst1

4.配置DB2服务器的TCP/IP通信
4.1 设置DB2服务器的通信协议

[root@xuhz ~]# su - entegor1
[db2inst1@xuhz ~]$ db2set -all
    [i] DB2AUTOSTART=NO
    [g] DB2SYSTEM=xuhz
    [g] DB2INSTDEF=db2inst1
    [g] DB2ADMINSERVER=dasusr1

[db2inst1@xuhz ~]$ db2set DB2COMM=tcpip
[db2inst1@xuhz ~]$ db2set -all

    [i] DB2COMM=TCPIP
    [i] DB2AUTOSTART=NO
    [g] DB2SYSTEM=xuhz
    [g] DB2INSTDEF=db2inst1
    [g] DB2ADMINSERVER=dasusr1
4.3 更新服务器数据库管理文件

[db2inst1@xuhz ~]$ db2 get dbm cfg |grep SVCENAME
 TCP/IP Service name                          (SVCENAME) =
 SSL service name                         (SSL_SVCENAME) =


[db2inst1@xuhz ~]$ db2 update dbm cfg using SVCENAME 50000
    DB20000I  The UPDATE DATABASE MANAGER CONFIGURATION command completed
    successfully.


[db2inst1@xuhz ~]$ db2 get dbm cfg |grep SVCENAME
     TCP/IP Service name                          (SVCENAME) = 60006
     SSL service name                         (SSL_SVCENAME) =

4.4 验证通信端口状态

[db2inst1@xuhz ~]$ db2start
    06/09/2014 19:38:44     0   0   SQL1063N  DB2START processing was successful.
    SQL1063N  DB2START processing was successful.
[db2inst1@xuhz ~]$ netstat -an |grep 50000
    tcp        0      0 0.0.0.0:60006               0.0.0.0:*                   LISTEN

5. 创建数据库

[db2inst1@xuhz ~]$ db2 create db entegor1 using codeset UTF-8 territory CN pagesize 8192
DB20000I  The CREATE DATABASE command completed successfully.
[db2inst1@xuhz ~]$ db2 connect to entegor1

   Database Connection Information

 Database server        = DB2/LINUXX8664 10.5.3
 SQL authorization ID   = DB2INST1
 Local database alias   = HONCHO


====================附录: db2创建实例时出错的处理!!!!!====================

非常诡异的一次数据库实例创建失败
一台新机器,以root身份,安装DB2后,然后将license 解压开,然后创建实例/opt/ibm/db2/V9.7/instance/db2icrt -a server -u db2fenc1 db2inst1,报如下错误:

cp: omitting directory `/opt/data/ibm/db2/V9.7/adm/db2V9.7'
DBI1086E  An attempt to copy the file or directory /opt/data/ibm/db2/V9.7/adm to
      /home/db2inst1/sqllib/adm failed.

Explanation:

An error occurred when attempting to duplicate the given file or
directory. The command could not be processed successfully.

User response:

Determine why the specified file or directory could not be copied and
then try the command again.

执行/opt/ibm/db2/V9.7/instance/db2ilist发现有值,切换db2inst1 用户执行db2start失败,创建实例不成功,
见鬼了,root居然没有拷贝权限,这不瞎扯啊。感觉像是创建实例时会拷贝安装目录下的adm目录到实例目录下,不服,再来,看看创建实例时究竟做啥,删除实例目录下的sqllib文件夹,开启debug模式,

/opt/ibm/db2/V9.7/db2icrt -d -a server  -u db2fenc1 db2inst1 > $HOME/a.log,查看a.log最后几行

## call function update_adm
DBI1086E  An attempt to copy the file or directory /opt/data/ibm/db2/V9.7/adm to
      /home/db2inst1/sqllib/adm failed.

Explanation:

An error occurred when attempting to duplicate the given file or
directory. The command could not be processed successfully. 可以定位update_adm,仔细检查adm目录下,突然发现我解压的license文件夹在adm目录下,mv走,创建成功。adm目录下共有47个文件,全部为bin  bin,

猜测创建实例时update_adm可能用db2inst1用户整体拷贝安装目录下的adm文件夹到实例用户sqllib目录下,由于多了一个root  root的文件夹,结果导致失败。后来尝试用root用户创建文件,db2icrt 成功。后来尝试将文件夹更改权限777,更改chown -R bin:bin  XXX,不过实例始终不能创建成功。为啥有文件夹就不行呢?

 

posted on 2016-07-19 09:43  fantiejun0436  阅读(978)  评论(0)    收藏  举报

导航