ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Linux上安装DB2 V10

Linux上安装DB2 V10

原创 Linux操作系统 作者:woshishui11211 时间:2015-03-16 16:25:23 0 删除 编辑

Linux上安装DB2 V10

 

 

一、    环境描述

主机:192.168.205.56 Redhat 5.8 X64

软件: DB2 V10.1

 

二、    上传安装文件

将安装文件db2_v101_linuxx64_expc.tar.gz上传到服务器上

 

三、    检查包

# rpm -qa|grepcompat-libstdc

 

四、    配置 Linux 内核参数

#vi /etc/sysctl.conf文件,添加内核参数

kernel.msgmni =1024

kernel.sem = 250 256000  32 1024

使更改激活:sysctlp

 

五、    安装

# tar -zxvf db2_v101_linuxx64_expc.tar.gz

# cdexpc

# ./db2_install

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.1

 

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

Install into default directory (/opt/ibm/db2/V10.1) ? [yes/no]

Yes

………………..省略

 

The execution completed successfully.

 

For more information see the DB2 installation log at

 

六、    创建用户组和用户名

[root@oracleexpc]# groupadd -g 2000 db2iadm1

[root@oracleexpc]# groupadd -g 2001 db2fadm1

[root@oracleexpc]# useradd -m -g db2iadm1 -d /home/db2inst1 db2inst1

[root@oracleexpc]# useradd -m -g db2fadm1 -d /home/db2fenc1 db2fenc1

[root@oracleexpc]# passwd db2inst1

Changing password for user db2inst1.

New UNIX password:

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

[root@oracleexpc]# passwd db2fenc1

Changing password for user db2fenc1.

New UNIX password:

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

密码设置成和用户名一样

 

七、    安装License(产品许可证)

# cd /opt/ibm/db2/V10.1/adm/

# chmod -R 775 *

# ./db2licm -a /tmp/expc/db2/license/db2expc_uw.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.1/license/en_US.iso88591"

 

八、    创建实例和样本数据库

因为要创建数据库就要先创建实例,数据库运行在实例之上

DASDatabase Administrator Server)是一个特殊类型的实例,主要执行远程管理任务

实例和数据库区别:实例本质上由一组后台进程和共享内存组成,数据库是物理的,表、索引存放在数据库中要占物理存储,实例是逻辑的,是共享内存、进程、一些配置文件(实例目录)的集合,实例停止时,共享内存释放,进程停止。

可以建多个实例

 

使用db2icrt创建实例

 

# cd /opt/ibm/db2/V10.1/instance/

# chmod -R 775 *

# ./db2icrt -p 50000 -u db2fenc1 db2inst1

过程略

The execution completed successfully.

 

# su - db2inst1

$ db2sampl

 

  Starting the DB2 instance...

  Creating database "SAMPLE"...

  Connecting to database "SAMPLE"...

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

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

  Stopping the DB2 instance...

 

  'db2sampl' processing complete.

 

$ db2start

SQL1063N  DB2START processing was successful.

 

$ db2 connect to sample

 

   Database Connection Information

 

 Database server        = DB2/LINUXX8664 10.1.0

 SQL authorization ID   = DB2INST1

 Local database alias   = SAMPLE

 

$ db2 "select * from staff"

 

ID     NAME      DEPT   JOB   YEARS  SALARY    COMM    

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

    10 Sanders       20 Mgr7  98357.50         -

    20 Pernal        20 Sales      8  78171.25    612.45

    30 Marenghi      38 Mgr5  77506.75         -

    40 O'Brien       38 Sales      6  78006.00    846.55

    50 Hanes         15 Mgr10  80659.80         -

    60 Quigley       38 Sales      -  66808.30    650.25

    70 Rothman       15 Sales      7  76502.83   1152.00

    80 James         20 Clerk      -  43504.60    128.20

    90 Koonitz       42 Sales      6  38001.75   1386.70

   100 Plotz         42 Mgr7  78352.80         -

   110 Ngan          15 Clerk      5  42508.20    206.60

   120 Naughton      38 Clerk      -  42954.75    180.00

   130 Yamaguchi     42 Clerk      6  40505.90     75.60

   140 Fraye         51 Mgr6  91150.00         -

   150 Williams      51 Sales      6  79456.50    637.65

   160 Molinare      10 Mgr7  82959.20         -

   170 Kermisch      15 Clerk      4  42258.50    110.10

   180 Abrahams      38 Clerk      3  37009.75    236.50

   190 Sneider       20 Clerk      8  34252.75    126.50

   200 Scoutten      42 Clerk      -  41508.60     84.20

   210 Lu            10 Mgr10  90010.00         -

   220 Smith         51 Sales      7  87654.50    992.80

   230 Lundquist     51 Clerk      3  83369.80    189.65

   240 Daniels       10 Mgr5  79260.25         -

   250 Wheeler       51 Clerk      6  74460.00    513.30

   260 Jones         10 Mgr12  81234.00         -

   270 Lea           66 Mgr9  88555.50         -

   280 Wilson        66 Sales      9  78674.50    811.50

   290 Quill         84 Mgr10  89818.00         -

   300 Davis         84 Sales      5  65454.50    806.10

   310 Graham        66 Sales     13  71000.00    200.30

   320 Gonzales      66 Sales      4  76858.20    844.00

   330 Burke         66 Clerk      1  49988.00     55.50

   340 Edwards       84 Sales      7  67844.00   1285.00

   350 Gafney        84 Clerk      5  43030.50    188.00

 

  35 record(s) selected.

 

九、    创建das管理服务器

 

为了远程客户端能够用控制中心来控制数据库服务器,需要在数据库服务器上安装 das,当然,如果只是远程连接而不是远程管理,可以不用装

# groupadd -g 2002 db2asgrp

# useradd -m -g db2asgrp -d /home/db2as db2as

# passwd db2as

Changing password for user db2as.

New UNIX password:

BAD PASSWORD: it is too short

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

密码设置成和用户名一样

 

 [root@oracle instance]# cd /opt/ibm/db2/V10.1/instance/

[root@oracle instance]# ./dascrt -u db2as

DBI1070I  Programdascrt completed successfully.

 

 

[root@oracle instance]# su - db2as

[db2as@oracle ~]$ db2admin start

SQL4409W  The DB2 Administration Server is already active.

[db2as@oracle ~]$ su - db2inst1

Password:

 

$ db2 get dbmcfg|grep SVCENAME

 TCP/IP Service name                          (SVCENAME) =

 SSL service name                         (SSL_SVCENAME) =

 

[db2inst1@oracle ~]$ db2 update dbmcfg using SVCENAME 50000

DB20000I  The UPDATE DATABASE MANAGER CONFIGURATION command completed

successfully.

 

db2set DB2COMM=tcpip

 

[db2inst1@oracle ~]$ db2 get dbmcfg|grep SVCENAME

 TCP/IP Service name                          (SVCENAME) = 50000

 SSL service name                         (SSL_SVCENAME) =

 

重启数据库

$ db2stop

$ db2start

SQL1063N  DB2START processing was successful.

[db2inst1@oracle ~]$ netstat -nat|grep 50000

tcp        0      0 0.0.0.0:50000               0.0.0.0:*                   LISTEN 

 

$ db2licm –l//看一下License的情况,svcename在客户端连接时需要用到

Product name:                     "DB2 Express-C"

License type:                     "Unwarranted"

Expiry date:                      "Permanent"

Product identifier:               "db2expc"

Version information:              "10.1"

Max number of CPUs:               "2"

Max amount of memory (GB):        "4"

Enforcement policy:               "Soft Stop"

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

请登录后发表评论 登录
全部评论

注册时间:2014-03-15

  • 博文量
    39
  • 访问量
    271859