RHEL6.5下DB2 V10.1 安裝

stonebox1122發表於2015-07-29

1、 解壓安裝包

[root@linuxclient ~]# tar -xvzf /mnt/hgfs/data/ibm/db2/v10.1_linuxx64_server.tar.gz

[root@linuxclient ~]# ls server/

db2  db2ckupgrade  db2_deinstall  db2_install  db2ls  db2prereqcheck  db2setup  installFixPack

 

2、 安裝

[root@linuxclient ~]# cd server/

[root@linuxclient server]# ./db2_install -b /opt/ibm/db2/V10.1 -p ESE

 

3、 建立使用者和組

[root@linuxclient server]# groupadd -g 901 db2iadm1

[root@linuxclient server]# groupadd -g 902 db2fadm1

[root@linuxclient server]# groupadd -g 903 dasadm1

[root@linuxclient ~]# useradd -g db2iadm1 -u 801 -s /bin/bash db2inst1

[root@linuxclient ~]# useradd -g db2fadm1 -u 802 -s /bin/bash db2fenc1

[root@linuxclient ~]# useradd -g dasadm1 -u 803 -s /bin/bash dasusr1

[root@linuxclient ~]# echo "123456" | passwd --stdin db2inst1

Changing password for user db2inst1.

passwd: all authentication tokens updated successfully.

[root@linuxclient ~]# echo "123456" | passwd --stdin db2fenc1

Changing password for user db2fenc1.

passwd: all authentication tokens updated successfully.

[root@linuxclient ~]# echo "123456" | passwd --stdin dasusr1

Changing password for user dasusr1.

passwd: all authentication tokens updated successfully.

 

4、 建立例項

建立管理伺服器

[root@linuxclient instance]# ./dascrt -u dasusr1

DBI1070I  Program dascrt completed successfully.

 

建立例項

[root@linuxclient instance]# ./db2icrt -u db2fenc1 db2inst1

DBI1446I  The db2icrt command is running, please wait.

 

 

DB2 installation is being initialized.

 

 Total number of tasks to be performed: 4

Total estimated time for all tasks to be performed: 309 second(s)

 

Task #1 start

Description: Setting default global profile registry variables

Estimated time 1 second(s)

Task #1 end

 

Task #2 start

Description: Initializing instance list

Estimated time 5 second(s)

Task #2 end

 

Task #3 start

Description: Configuring DB2 instances

Estimated time 300 second(s)

Task #3 end

 

Task #4 start

Description: Updating global profile registry

Estimated time 3 second(s)

Task #4 end

 

The execution completed successfully.

 

For more information see the DB2 installation log at "/tmp/db2icrt.log.45873".

DBI1070I  Program db2icrt completed successfully.

 

5、 啟動DB2

啟動管理伺服器

[root@linuxclient instance]# su - dasusr1

[dasusr1@linuxclient ~]$ db2admin start

SQL4409W  The DB2 Administration Server is already active.

 

啟動例項

[dasusr1@linuxclient ~]$ su - db2inst1

Password:

[db2inst1@linuxclient ~]$ db2start

07/03/2015 17:40:41     0   0   SQL1063N  DB2START processing was successful.

SQL1063N  DB2START processing was successful.

 

6、 配置DB2

設定開機自動啟動

[db2inst1@linuxclient ~]$ su -

Password:

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

[root@linuxclient instance]# ./db2iauto -on db2inst1

 

配置網路

[root@linuxclient instance]# su - db2inst1

[db2inst1@linuxclient ~]$ db2 update dbm cfg using SVCENAME 60000

DB20000I  The UPDATE DATABASE MANAGER CONFIGURATION command completed

successfully.

[db2inst1@linuxclient ~]$ db2set DB2COMM=TCPIP

 

7、 訪問資料庫

啟動例項

[db2inst1@linuxclient ~]$ db2start

07/03/2015 17:48:31     0   0   SQL1026N  The database manager is already active.

SQL1026N  The database manager is already active.

 

建立資料庫

[db2inst1@linuxclient ~]$ db2 create database sample using codeset utf-8 territory CN

DB20000I  The CREATE DATABASE command completed successfully.

 

連線到資料庫

[db2inst1@linuxclient ~]$ db2 connect to sample

 

   Database Connection Information

 

 Database server        = DB2/LINUXX8664 10.1.0

 SQL authorization ID   = DB2INST1

 Local database alias   = SAMPLE

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28536251/viewspace-1755242/,如需轉載,請註明出處,否則將追究法律責任。

相關文章