[root@a3470194 opt]# tar -zxvf db2_v1012_linuxia32_expc.tar.gz
[root@a3470194 opt]# ls
db2_v1012_linuxia32_expc.tar.gz expc lost+found rh
[root@a3470194 opt]# cd expc/
[root@a3470194 expc]# ls
db2 db2ckupgrade db2_deinstall db2_install db2ls db2prereqcheck db2setup doc
[root@a3470194 expc]# ./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
DB2 installation is being initialized.
Total number of tasks to be performed: 35
Total estimated time for all tasks to be performed: 990 second(s)
。。。。。。。。。。
。。。。。。
。。。
Task #37 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #37 end
The execution completed successfully.
For more information see the DB2 installation log at
"/tmp/db2_install.log.2705".
创建用户组(用户名)
db2iadm1(db2inst1)
db2fadm1( db2fenc1)
[root@a3470194 expc]# groupadd -g 2000 db2iadm1
[root@a3470194 expc]# groupadd -g 2001 db2fadm1
[root@a3470194 expc]# useradd -m -g db2iadm1 -d /home/db2inst1 db2inst1
[root@a3470194 expc]# useradd -m -g db2fadm1 -d /home/db2fenc1 db2fenc1
[root@a3470194 expc]# passwd db2inst1
[root@a3470194 expc]# passwd db2fenc1
安装 license (产品许可证)
[root@a3470194 adm]# pwd
/opt/ibm/db2/V10.1/adm
[root@a3470194 adm]# chmod -R 775 *
[db2inst1@a3470194 adm]$ ./db2licm -a /tmp/seagull/db2v10/license/db2ese_c.lic
创建实例和样本数据库
[root@a3470194 instance]# pwd
/opt/ibm/db2/V10.1/instance
[root@a3470194 instance]# chmod -R 775 *
[root@localhost instance]# ./db2icrt -p 50000 -u db2fenc1 db2inst1
DBI1446I The db2icrt command is running.
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.2571".
Required: Review the following log file also for warnings or errors:
"/tmp/db2icrt_local.log.*"
DBI1070I Program db2icrt completed successfully.
[root@localhost instance]# su - db2inst1
[db2inst1@localhost ~]$ db2sampl
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"...
'db2sampl' processing complete.
[db2inst1@localhost ~]$ db2start
SQL1026N The database manager is already active.
[db2inst1@localhost ~]$ db2 connect to sample
Database Connection Information
Database server = DB2/LINUX 10.1.2
SQL authorization ID = DB2INST1
Local database alias = SAMPLE
[db2inst1@localhost ~]$ db2 "select * from staff"
ID NAME DEPT JOB YEARS SALARY COMM
------ --------- ------ ----- ------ --------- ---------
10 Sanders 20 Mgr 7 98357.50 -
20 Pernal 20 Sales 8 78171.25 612.45
30 Marenghi 38 Mgr 5 77506.75 -
40 O'Brien 38 Sales 6 78006.00 846.55
50 Hanes 15 Mgr 10 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 Mgr 7 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 Mgr 6 91150.00 -
150 Williams 51 Sales 6 79456.50 637.65
160 Molinare 10 Mgr 7 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 Mgr 10 90010.00 -
220 Smith 51 Sales 7 87654.50 992.80
230 Lundquist 51 Clerk 3 83369.80 189.65
240 Daniels 10 Mgr 5 79260.25 -
250 Wheeler 51 Clerk 6 74460.00 513.30
260 Jones 10 Mgr 12 81234.00 -
270 Lea 66 Mgr 9 88555.50 -
280 Wilson 66 Sales 9 78674.50 811.50
290 Quill 84 Mgr 10 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,当然,如果只是远程连接而不是远程管理,可以不用装,这里我安装了一下。
[root@a3470194 expc]# groupadd -g 2002 db2asgrp
[root@a3470194 expc]# useradd -m -g db2asgrp -d /home/db2as db2as
[root@a3470194 expc]# passwd db2as
[db2as@localhost ~]$ su - db2as
Password:
[db2as@localhost ~]$ su -
Password:
[root@localhost ~]# cd /opt/ibm/db2/V10.1/instance/
[root@localhost instance]# ./dascrt -u db2as
DBI1070I Program dascrt completed successfully.
[root@localhost instance]# su - db2as
[db2as@localhost ~]$ db2admin start
SQL4409W The DB2 Administration Server is already active.
确认一下 db2inst1 实例的服务名
[db2as@localhost ~]$ su - db2inst1
Password:
[db2inst1@localhost ~]$ db2 get dbm cfg|grep SVCENAME
TCP/IP Service name (SVCENAME) =
SSL service name (SSL_SVCENAME) =
[db2inst1@localhost ~]$ db2 update dbm cfg using SVCENAME 50000
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
Successfully.
[db2inst1@localhost ~]$ db2 get dbm cfg|grep SVCENAME
TCP/IP Service name (SVCENAME) = 50000
SSL service name (SSL_SVCENAME) =
#注解:svcename 在客户端连接时需要用到
看一下 license 情况[db2inst1@localhost ~]$ db2licm -l