Linux下安装多个DB2副本

1、查看系统上当前存在的DB2副本:

[root@localhost home]# db2ls

 

Install Path                       Level   Fix Pack   Special Install Number   Install Date                  Installer UID

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

/opt/ibm/db2/V9.7                 9.7.0.7        7                            Fri Dec  7 01:58:51 2012 CST             0

当前系统上的DB2版本为9.7.0.7,副本安装路径为/opt/ibm/db2/V9.7.

 

2、查看系统上当前DB2实例的用户和组信息:

[db2inst@localhost home]$ ls -l

总用量 20

drwxr-xr-x.  4 dasusr  dasadm  4096 12  7 02:05 dasusr

drwx------.  3 db2fenc db2fgrp 4096 11 30 21:46 db2fenc

drwxr-xr-x. 10 db2inst db2grp  4096 12 12 05:26 db2inst

drwxr-xr-x.  3 root    root    4096 12 12 05:28 db2install

可知,当前实例所有者db2inst所在组为db2grpDAS用户为dasusr,组为dasadm。受防护的用户为db2fenc,组为db2fgrp

 

由于每台计算机上只能有一个DAS,所以不用为新的副本创建DAS,也就不用创建相应的DAS用户。

 

3、为新DB2副本实例创建实例所有者用户和组:

[root@localhost home]# groupadd db2grp2

[root@localhost home]# useradd -g db2grp2 -d /home/db2inst2 -s /bin/bash db2inst2

[root@localhost home]# passwd db2inst2

 

4、由于系统上已存在DB2副本,并且安装时使用了缺省安装路径/opt/ibm/db2/V9.7,所以必须为即将安装的DB2副本指定安装路径。如果使用“DB2安装”向导安装新的副本,可以不用指定安装路径,会使用缺省路径:/opt/ibm/db2/V9.7_##,其中##范围是0199,。此处创建安装路径为:

[root@localhost ~]# mkdir /opt/ibm/db2/V9.7_01

 

5、使用root用户安装新的DB2副本。注意,非root用户安装不支持多个DB2副本。

[root@localhost db2install]# ls

server  v9.7fp5_linuxia32_server.tar.gz

--此处安装包已经解压过。

 

[root@localhost server]# ./db2_install -b /opt/ibm/db2/V9.7_01 -p ESE -n

 

-b :指定安装路径。

-p productShotName :指定要安装的DB2数据库产品。此参数不区分大小写。当指定-n参数时,必须指定-p参数。可以在/home/db2install/server/db2/linux目录下的ComponentList.htm文件中找到产品短名称(productShotName)。下面是相应产品的短名称:

DB2 Enterprise Server EditionESE

DB2 Connect ServerCONSV

DB2 Workgroup Server EditionWSE

DB2 ExpressEXP

DB2 Personal EditionPE

IBM Data Server ClientCLIENT

IBM Data Server Runtime ClientRTCL

-n :指示非交互安装方式。当指定了此参数,必须指定-b-p

 

安装时发生了错误:

在此计算机上安装 "DB2 Enterprise Server Edition "

时发生了较小的错误。某些功能部件可能无法正常工作。

 

有关更多信息,请参阅 "/tmp/db2_install.log.7754" 上的 DB2 安装日志。

 

查看安装日志:

[root@localhost server]# more /tmp/db2_install.log.7754

 

DB2 安装”日志文件的开始时间: Wed Dec 12 06:53:46 2012 CST

============================================================

 

操作系统信息:Linux 2.6.32-71.el6.i686.#1 SMP Wed Sep 1 01:26:34 EDT 2

010 i686

警告: DBI1004W  检测到 /usr/lib/libdb2.so。此 DB2 副本在装入它的库时

可能

      遇到了问题。

 

说明:

 

从另一个 DB2 副本运行了 db2ln 命令,该命令在 /usr/lib 中创建了符号链接

。这些符号链接干扰了同一系统上运行的多个 DB2 副本,而无论那些副本是使

不同修订包的同一版本还是不同的版本。

 

用户响应:

 

在运行 db2ln 命令的安装路径中,运行 db2rmln 命令以除去这些链接。

 

在一个系统上安装多个DB2副本时存在限制,使用db2ln命令为一个DB2副本创建链接会导致其他的副本不起作用。如果要让多个DB2副本共存,不能创建链接。

根据日志,做出如下响应:

[root@localhost V9.7]# find /opt/ibm/db2/V9.7 -iname db2ln

/opt/ibm/db2/V9.7/cfg/db2ln

[root@localhost V9.7]# cd cfg

[root@localhost cfg]# ./db2rmln

 

6、为新DB2副本创建实例:

[root@localhost instance]# ./db2icrt -p 50001 -u db2fenc db2inst2

DBI1070I  Program db2icrt completed successfully.

 

7、验证安装:

[root@localhost instance]# su - db2inst2

[db2inst2@localhost ~]$ db2start

12/12/2012 09:56:40     0   0   SQL5043N  Support for one or more communications protocols failed to start successfully. However, core database manager functionality started successfully.

SQL1063N  DB2START processing was successful.

SQL5043N:对一个或多个通信协议的支持未能成功启动。但是,成功启动了核心数据库管理器功能。

查看diag.log获取更详细信息:

MESSAGE : ADM7007E  The SVCENAME DBM configuration parameter, "50001", is configured with a port or a service name.  When it is configured with a service name, the TCP/IP services files is used to map the service name to a port number.  The port specified in this field is being used by another process.  Resolve this problem by either deleting the process using the port or use another port.

原因是50001端口已经指定给了另外一个DB2副本的db2inst实例。

查看db2inst2实例SVCENAME参数值:

[db2inst2@localhost ~]$ db2 get dbm cfg | grep SVCENAME

 TCP/IP Service name                     (SVCENAME) = 50001

查看db2inst实例SVCENAME参数值:

[db2inst2@localhost ~]$ su - db2inst

密码:

[db2inst@localhost ~]$ db2 get dbm cfg | grep SVCENAME

 TCP/IP Service name                     (SVCENAME) = 50001

 

两个实例使用了同一个端口号!

更改新创建实例db2inst2的端口号为500002

首先查看该端口号是否被占用:

[root@localhost db2inst]# netstat -ntlp | grep 50002

没有返回结果证明该端口号没有被占用。

[db2inst2@localhost ~]$ db2 update dbm cfg using SVCENAME 50002

DB20000I  The UPDATE DATABASE MANAGER CONFIGURATION command completed successfully.

[db2inst2@localhost ~]$ db2stop

2012-12-12 10:36:12     0   0   SQL1064N  DB2STOP processing was successful.

SQL1064N  DB2STOP processing was successful.

[db2inst2@localhost ~]$ db2start

12/12/2012 10:36:37     0   0   SQL1063N  DB2START processing was successful.

SQL1063N  DB2START processing was successful.

实例正常启动!

 

[db2inst2@localhost ~]$ db2sampl         --创建sample数据库

 

  Creating database "SAMPLE"...

  Connecting to database "SAMPLE"...

  Creating tables and data in schema "DB2INST2"...

  Creating tables with XML columns and XML data in schema "DB2INST2"...

 

  'db2sampl' processing complete.

 

[db2inst2@localhost ~]$ db2 connect to sample

 

   Database Connection Information

 

 Database server        = DB2/LINUX 9.7.5

 SQL authorization ID   = DB2INST2

 Local database alias   = SAMPLE

 

[db2inst2@localhost ~]$ db2 "select * from staff where dept=20"

 

ID     NAME      DEPT   JOB   YEARS  SALARY    COMM    

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

    10 Sanders       20 Mgr        7  98357.50         -

    20 Pernal        20 Sales      8  78171.25    612.45

    80 James         20 Clerk      -  43504.60    128.20

   190 Sneider       20 Clerk      8  34252.75    126.50

 

  4 record(s) selected.

数据库使用正常!

检查原db2inst实例数据库是否正常:

[root@localhost db2inst]# su - db2inst

[db2inst@localhost ~]$ db2 connect to sample

 

   Database Connection Information

 

 Database server        = DB2/LINUX 9.7.7

 SQL authorization ID   = DB2INST

 Local database alias   = SAMPLE

[db2inst@localhost ~]$ db2 "select * from t where id<4"

 

ID          NAME     

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

          1 a         

          2 b        

          3 c        

 

  3 record(s) selected.

使用正常。

 

 

[db2inst2@localhost ~]$ db2ls       --系统上有两个DB2副本

 

Install Path                       Level   Fix Pack   Special Install Number   Install Date                  Installer UID

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

/opt/ibm/db2/V9.7                 9.7.0.7        7                            Fri Dec  7 01:58:51 2012 CST             0

/opt/ibm/db2/V9.7_01              9.7.0.5        5                            Wed Dec 12 07:23:01 2012 CST             0

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25744374/viewspace-750953/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/25744374/viewspace-750953/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值