vi /etc/hosts
(127.0.0.1 localhost
192.168.1.53 linux-wmv8)
vi /etc/services
db2inst1 50000/tcp(加在最后)
mkdir /dbdata
mkdir /dbdatabk
④解压安装包
linux-h2rf:/mnt # unzip db2v97.zip
⑤安装DB2数据仓库,安装步骤如下:
A、创建用户和用户组
linux-h2rf:/mnt/dbdata/softwares/db2v97 # groupadd -g 901 db2grp
linux-h2rf:/mnt/dbdata/softwares/db2v97 # groupadd -g 902 db2fgrp
linux-h2rf:/mnt/dbdata/softwares/db2v97 # groupadd -g 903 db2agrp
linux-h2rf:/mnt/dbdata/softwares/db2v97 # useradd -g db2grp -u 801 -d /home/db2inst1 -m -s /bin/sh db2inst1
linux-h2rf:/mnt/dbdata/softwares/db2v97 # useradd -g db2fgrp -u 802 -d /home/db2fenc -m -s /bin/sh db2fenc
linux-h2rf:/mnt/dbdata/softwares/db2v97 # useradd -g db2agrp -u 803 -d /home/db2das -m -s /bin/sh db2das
B、db2inst1用户设置密码
linux-h2rf:/mnt/dbdata/softwares/db2v97 # passwd db2inst1
Changing password for db2inst1.
New Password:
Bad password: it is based on a dictionary word
Reenter New Password:
Password changed.
C、确认用户和用户组
linux-h2rf:/mnt/dbdata/softwares/db2v97 # more /etc/group |grep db2
dialout:x:16:milo,db2inst1,db2fenc,db2das
video:x:33:milo,db2inst1,db2fenc,db2das
db2grp:!:901:
db2fgrp:!:902:
db2agrp:!:903:
linux-h2rf:/mnt/dbdata/softwares/db2v97 # more /etc/passwd |grep db2
db2inst1:x:801:901::/home/db2inst1:/bin/sh
db2fenc:x:802:902::/home/db2fenc:/bin/sh
db2das:x:803:903::/home/db2das:/bin/sh
D、权限设置
chown db2inst1:db2grp /dbdata –R
chown db2inst1:db2grp /dbdatabk –R
drwxr-xr-x 6 db2inst1 db2grp 4096 Apr 24 10:50 dbdata
drwxr-xr-x 3 db2inst1 db2grp 4096 May 8 08:59 dbdatabk
E、语言参数设置:
vi /home/db2inst1/.profile
if [ -f /home/db2inst1/sqllib/db2profile ]; then
. /home/db2inst1/sqllib/db2profile
fi
export LANG=zh_CN.GBK
G、安装
linux-h2rf:/mnt/dbdata/softwares/db2v97/ese # ./db2_install -b /opt/ibm/db2/V9.7 -p ese -f NOTSAMP
H、注册license key
/opt/ibm/db2/V9.7/adm/db2licm -a /root/Desktop/dbdata/softwares/db2v97/db2ese_c.lic 要是mnt 就直接是mnt pwd查看绝对路径
I、创建实例
linux-h2rf:/opt/ibm/db2/V9.7/instance # ./dascrt -u db2das
SQL4406W The DB2 Administration Server was started successfully.
DBI1070I Program dascrt completed successfully.
linux-h2rf:/opt/ibm/db2/V9.7/instance # ./db2icrt -u db2fenc db2inst1
DBI1070I Program db2icrt completed successfully.
linux-h2rf:/opt/ibm/db2/V9.7/instance # ./db2iauto -on db2inst1
linux-h2rf:/opt/ibm/db2/V9.7/instance #
允许SMS的多页分配:运行 /opt/ibm/db2/V9.7/cfg/db2ln
J、数据库仓库启动和设置
linux-h2rf:/opt/ibm/db2/V9.7/instance # su - db2inst1
linux-h2rf:~> db2set DB2COMM=tcpip
linux-h2rf:~> db2set -all
linux-h2rf:~> db2 update dbm cfg using svcename db2inst1
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
successfully.
linux-h2rf:~> db2set DB2CODEPAGE=1386
linux-h2rf:~> db2set DB2TERRITORY=86
linux-h2rf:~> db2 terminate
linux-h2rf:~> db2stop
linux-h2rf:~> db2start
04/15/2015 16:44:47 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
linux-h2rf:~> db2 create database BDW on /dbdata using codeset GBK territory CN
linux-h2rf:~>
DB20000I The CREATE DATABASE command completed successfully.