SUSE10 SP1上安装DB2v9.5数据库

 

1      环境概述

OS系统:SUSE10 SP1 X64

DB2版本:DB2 V9.5 for Linux 64

 

2      安装DB2数据库

2.1   安装前准备

2.1.1   安装必须依赖包

针对SUSE操作系统

libaio-32bit-0.3.104-14.2.x86_64.rpm

libaio-0.3.104-14.2.x86_64.rpm

compat-libstdc++-5.0.7-22.2.x86_64.rpm

ksh-93r-12.28.x86_64.rpm

openssl-0.9.8a-18.15.x86_64.rpm

rsh-server-0.17-573.2.x86_64.rpm

nfs-utils-1.0.7-36.21.x86_64.rpm

 

 

2.1.2   系统资源限制修改

DB02-DB2:/db2_inst  # ulimit -a

data  seg size           (kbytes, -d)  unlimited

file  size               (blocks, -f)  unlimited

open  files                      (-n) 65536

 

 

2.1.3   系统内核参数修改

参考官方安装文档

通过编辑/etc/sysctl.conf文件来修改内核参数

以16GB RAM的就是计算机为例:

kernel.shmmni=4096

kernel.shmmax=17179869184

kernel.shmall=8388608

#kernel.sem=<SEMMSL>  <SEMMNS> <SEMOPM> <SEMMNI>

kernel.sem=250  256000 32 4096

kernel.msgmni=16384

kernel.msgmax=65536

kernel.msgmnb=65536

4. 运行 sysctl时候附带  -p 参数,以从缺省文件/etc/sysctl.conf 中装入 sysctl 的设置:

sysctl -p

 

要使更改在每次重新引导之后生效:

(SUSE  Linux)激活 boot.sysctl

(Red  Hat)rc.sysinit 初始化脚本将自动读取 /etc/sysctl.conf文件

 

 

2.1.4   创建DB2用户和用户组

对于Linux 操作系统

groupadd  -g 999 db2iadm1

groupadd  -g 998 db2fadm1

groupadd  -g 997 dasadm1

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

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

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

passwd  db2inst1

passwd  db2fenc1

passwd  dasusr1

 

 

2.2   安装DB2数据库

DB02-DB2:/db2_inst # tar xf db2_v95_linuxx64_server.tar.gz

DB02-DB2:/db2_inst # ls -lrt

total 610384

drwxr-xr-x 4 root root      4096 Oct  6   2007 server

drwx------ 5 root root      4096 Oct 10 19:19 db2lic

-rw------- 1 root root 624408392 Oct 10 19:19  db2_v95_linuxx64_server.tar.gz

DB02-DB2:/db2_inst # cd server

DB02-DB2:/db2_inst/server # ls -lrt

total 48

-r-xr-xr-x  1 bin  bin 4560 Oct  6  2007 db2prereqcheck

-r-xr-xr-x  1 bin  bin 4552 Oct  6  2007 db2setup

-r-xr-xr-x  1 bin  bin 4570 Oct  6  2007 db2_install

-r-xr-xr-x  1 bin  bin 4700 Oct  6  2007 db2_deinstall

drwxr-xr-x 15 bin bin 4096 Oct  6   2007 doc

-r-xr-xr-x  1 bin  bin 4588 Oct  6  2007 installFixPack

drwxr-xr-x  6 bin  bin 4096 Oct  6  2007 db2

DB02-DB2:/db2_inst/server # ./db2_install

 

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

 

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

Do you want to choose a different directory to install  [yes/no] ?

no

 

 

Specify one of the following keywords to install DB2  products.

 

  ESE

  CONSV

  WSE

  EXP

  PE

  CLIENT

  RTCL

 

Enter "help" to redisplay product names.

 

Enter "quit" to exit.

 

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

ESE

DB2 installation is being initialized.

 

Total number of tasks to be performed: 43

Total estimated time for all tasks to be performed:  1688

…………………………………………(省略N行)

The execution completed successfully.

 

For more information see the DB2 installation log at

"/tmp/db2_install.log.4423".

DB02-DB2:/db2_inst/server #

 

2.3   添加软件license

DB02-DB2:/opt/ibm/db2/V9.5/adm  # ./db2licm -a /root/db2ese_c_v9.5.lic

LIC1402I  License added successfully.

DB02-DB2:/opt/ibm/db2/V9.5/adm  # ./db2licm -l

Product  name:                     "DB2  Enterprise Server Edition"

License  type:                     "CPU  Option"

Expiry  date:                       "Permanent"

Product  identifier:                "db2ese"

Version information:              "9.5"

Features:

DB2  Database Partitioning:        "Not  licensed"

DB2  Performance Optimization ESE: "Not licensed"

DB2  Storage Optimization:         "Not  licensed"

DB2  Advanced Access Control:      "Not  licensed"

DB2  Geodetic Data Management:     "Not  licensed"

DB2  pureXML ESE:                  "Not  licensed"

IBM  Homogeneous Federation ESE:   "Not  licensed"

IBM  Homogeneous Replication ESE:  "Not  licensed"

 

2.4   建立DB2文件的链接

为DB2数据库系统文件创建指向/usr/lib目录的链接,并为包含文件创建指向/usr/include目录的链接

DB02-DB2:/opt/ibm/db2/V9.5/cfg  # ./db2ln

 

3      创建数据库实例

3.1   创建数据库实例db2inst1

DB02-DB2:/opt/ibm/db2/V9.5/instance  # ./db2icrt -a server -u db2fenc1 db2inst1

DBI1070I  Program db2icrt completed successfully.

DB02-DB2:/opt/ibm/db2/V9.5/instance  #

 

3.2   创建DAS管理服务器实例

DB02-DB2:/opt/ibm/db2/V9.5/instance  # ./dascrt -u dasusr1

SQL4406W  The DB2 Administration Server was started  successfully.

DBI1070I  Program dascrt completed successfully.

DB02-DB2:/opt/ibm/db2/V9.5/instance  #

 

3.3   设置开机启动数据量实例

DB02-DB2:/opt/ibm/db2/V9.5/instance  # su - db2inst1

db2inst1@DB02-DB2:~>  db2iauto -on db2inst1

 

3.4   设置DB2通信方式

db2set  DB2COMM=tcpip

db2stop

db2start

 

3.5   创建sample数据库

db2inst1@DB02-DB2:~>  db2 get instance

 The current database manager instance  is:  db2inst1

db2inst1@DB02-DB2:~>  db2sampl

  Creating database "SAMPLE"...

  Connecting to database  "SAMPLE"...

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

  'db2sampl' processing complete.

db2inst1@DB02-DB2:~>

 

可以指定路径和名称

db2inst1@DB02-DB2:~>db2sampl  -dbpath /db2/sample -name sample

 


你可能感兴趣的:(数据库,安装,db2)