centos 6.2下安装db2 V9.7

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:69

1 从安装包中解压后执行./db2_install

2. 默认安装路径
[root@localhost ~]# cd /opt/ibm/db2/V9.7/instance

3. 添加用户组
[root@localhost etc]# groupadd db2iadm1
[root@localhost etc]# groupadd db2fadm1

4. 查看组号
[root@localhost etc]# cat group

5. 添加用户
[root@localhost etc]# useradd -g 501 db2inst1
[root@localhost etc]# useradd -g 502 db2fenc1
或者
[root@localhost etc]# useradd -g db2iadm1 db2inst1
[root@localhost etc]# useradd -g db2fadm1 db2fenc1

6. 设置密码
[root@localhost etc]# passwd db2inst1
[root@localhost etc]# passwd db2fenc1

7. 建立实例
[root@localhost instance]# ./db2icrt -a server -u db2fenc1 db2inst1
DBI1070I Program db2icrt completed successfully.

实例目录:位于/home/db2inst1/sqllib中

安装认证
/opt/ibm/db2/V9.7/adm
./db2licm -a /db2_home/expc/db2/license/db2expc_uw.lic

8. 建立sample数据库[db2inst1@localhost bin]$ pwd
/home/db2inst1/sqllib/bin

[db2inst1@localhost bin]$ 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.

--9. 针对WINDOWS:尝试在其他目录中建立db2inst2 INSTANCE,需提前设置好DB2INSTPROF变量

[root@localhost instance]# useradd -g 501 db2inst2
[root@localhost instance]# useradd -g 501 db2fenc2

查看全球级的变量
[root@localhost adm]# pwd
/opt/ibm/db2/V9.7/adm
[root@localhost adm]# ./db2set -all
[g] DB2SYSTEM=localhost.localdomain
[g] DB2INSTDEF=db2inst1

查看实例级的变量
[db2inst1@localhost adm]$ pwd
/home/db2inst1/sqllib/adm
[db2inst1@localhost adm]$ ./db2set -all
[g] DB2SYSTEM=localhost.localdomain
[g] DB2INSTDEF=db2inst1

设置DB2INSTPROF
[root@localhost adm]# pwd
/opt/ibm/db2/V9.7/adm

[root@localhost adm]# ./db2set DB2INSTPROF="/testdb2inst" -g

使用root用户建立db2inst2实例
[root@localhost instance]# ./db2icrt -a server -u db2fenc2 db2inst2
DBI1070I Program db2icrt completed successfully.

10.设置实例端口号,通讯方式
[db2inst1@localhost ~]$ db2 update dbm cfg using SVCENAME 50000
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed successfully.

[db2inst1@localhost ~]$ db2set DB2COMM=TCPIP

11.创建das并启动
[root@localhost instance]# groupadd -g 503 dasadm1
[root@localhost instance]# useradd -g dasadm1 dasusr1

[root@localhost instance]# ./dascrt -u dasusr1
SQL4406W The DB2 Administration Server was started successfully.
DBI1070I Program dascrt completed successfully.

[root@localhost etc]# passwd dasusr1

启动(作为dasadm_group中的一员):
[dasusr1@localhost ~]$ db2admin start

12.自动启动实例
[root@localhost instance]# ./db2iauto -on db2inst1

13.查看变量
[db2inst1@localhost bin]$ db2set -all
[i] DB2COMM=TCPIP
[i] DB2AUTOSTART=YES
[g] DB2SYSTEM=localhost.localdomain
[g] DB2INSTPROF=/testdb2inst
[g] DB2ADMINSERVER=dasusr1

14.查看或者更改DAS配置
db2 get admin cfg
db2 update admin cfg using

db2 catalog tcpip node sam_177 remote 169.254.25.177 server 50000
db2 catalog db sample as sample2 at node sam_177

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】