rhel 6.2使用db2install安装DB2 v10.5
2015-04-17 本文已影响729人
xiaoyuhao
解压
[root@db2 ~]# tar -xzvf v10.5_linuxx64_expc.tar.gz
[root@db2 ~]# ls -l
total 581408
-rw-------. 1 root root 1469 Apr 17 06:53 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 Apr 17 06:57 Desktop
drwxr-xr-x. 2 root root 4096 Apr 17 06:57 Documents
drwxr-xr-x. 2 root root 4096 Apr 17 06:57 Downloads
drwxr-xr-x. 3 root root 4096 Nov 30 03:31 expc
-rw-r--r--. 1 root root 44386 Apr 17 06:53 install.log
-rw-r--r--. 1 root root 10837 Apr 17 06:51 install.log.syslog
drwxr-xr-x. 2 root root 4096 Apr 17 06:57 Music
drwxr-xr-x. 2 root root 4096 Apr 17 06:57 Pictures
drwxr-xr-x. 2 root root 4096 Apr 17 06:57 Public
drwxr-xr-x. 2 root root 4096 Apr 17 06:57 Templates
-rw-r--r--. 1 root root 595253657 Apr 15 10:13 v10.5_linuxx64_expc.tar.gz
drwxr-xr-x. 2 root root 4096 Apr 17 06:57 Videos
[root@db2 expc]# ./db2_install
Requirement not matched for DB2 database "Server" . Version: "10.5.0.5".
Summary of prerequisites that are not met on the current system:
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*".
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "libstdc++.so.6".
DBI1324W Support of the db2_install command is deprecated.
Default directory for installation of products - /opt/ibm/db2/V10.5
***********************************************************
Install into default directory (/opt/ibm/db2/V10.5) ? [yes/no]
yes
Requirement not matched for DB2 database "Server" . Version: "10.5.0.5".
Summary of prerequisites that are not met on the current system:
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*".
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "libstdc++.so.6".
DB2 installation is being initialized.
Total number of tasks to be performed: 36
Total estimated time for all tasks to be performed: 1380 second(s)
Task #1 start
Description: Checking license agreement acceptance
Estimated time 1 second(s)
Task #1 end
Task #2 start
Description: Base Client Support for installation with root privileges
Estimated time 3 second(s)
Task #2 end
Task #3 start
Description: Product Messages - English
Estimated time 14 second(s)
Task #3 end
Task #4 start
Description: Base client support
Estimated time 307 second(s)
Task #4 end
Task #5 start
Description: Java Runtime Support
Estimated time 158 second(s)
Task #5 end
Task #6 start
Description: Java Help (HTML) - English
Estimated time 7 second(s)
Task #6 end
Task #7 start
Description: Base server support for installation with root privileges
Estimated time 7 second(s)
Task #7 end
Task #8 start
Description: Global Secure ToolKit
Estimated time 63 second(s)
Task #8 end
Task #9 start
Description: Java support
Estimated time 12 second(s)
Task #9 end
Task #10 start
Description: SQL procedures
Estimated time 3 second(s)
Task #10 end
Task #11 start
Description: ICU Utilities
Estimated time 35 second(s)
Task #11 end
Task #12 start
Description: Java Common files
Estimated time 18 second(s)
Task #12 end
Task #13 start
Description: Base server support
Estimated time 450 second(s)
Task #13 end
Task #14 start
Description: DB2 data source support
Estimated time 6 second(s)
Task #14 end
Task #15 start
Description: Spatial Extender server support
Estimated time 18 second(s)
Task #15 end
Task #16 start
Description: DB2 LDAP support
Estimated time 4 second(s)
Task #16 end
Task #17 start
Description: DB2 Instance Setup wizard
Estimated time 20 second(s)
Task #17 end
Task #18 start
Description: Integrated Flash Copy Support
Estimated time 3 second(s)
Task #18 end
Task #19 start
Description: Spatial Extender client
Estimated time 3 second(s)
Task #19 end
Task #20 start
Description: Communication support - TCP/IP
Estimated time 3 second(s)
Task #20 end
Task #21 start
Description: Base application development tools
Estimated time 35 second(s)
Task #21 end
Task #22 start
Description: DB2 Update Service
Estimated time 4 second(s)
Task #22 end
Task #23 start
Description: EnterpriseDB code
Estimated time 4 second(s)
Task #23 end
Task #24 start
Description: Sample database source
Estimated time 4 second(s)
Task #24 end
Task #25 start
Description: DB2 Text Search
Estimated time 123 second(s)
Task #25 end
Task #26 start
Description: Command Line Processor Plus
Estimated time 4 second(s)
Task #26 end
Task #27 start
Description: First Steps
Estimated time 3 second(s)
Task #27 end
Task #28 start
Description: Product Signature for DB2 Express-C
Estimated time 3 second(s)
Task #28 end
Task #29 start
Description: Setting DB2 library path
Estimated time 180 second(s)
Task #29 end
Task #30 start
Description: Executing control tasks
Estimated time 20 second(s)
Task #30 end
Task #31 start
Description: Updating global registry
Estimated time 20 second(s)
Task #31 end
Task #32 start
Description: Starting DB2 Fault Monitor
Estimated time 10 second(s)
Task #32 end
Task #33 start
Description: Updating the db2ls and db2greg link
Estimated time 1 second(s)
Task #33 end
Task #34 start
Description: Registering DB2 licenses
Estimated time 5 second(s)
Task #34 end
Task #35 start
Description: Setting default global profile registry variables
Estimated time 1 second(s)
Task #35 end
Task #36 start
Description: Initializing instance list
Estimated time 5 second(s)
Task #36 end
Task #37 start
Description: Registering DB2 Update Service
Estimated time 30 second(s)
Task #37 end
Task #38 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #38 end
The execution completed successfully.
For more information see the DB2 installation log at
"/tmp/db2_install.log.3408".
创建db2所需用户和组
[root@db2 ~]# id db2inst1
uid=501(db2inst1) gid=102(db2iadm1) groups=102(db2iadm1),101(dasadm1)
[root@db2 ~]# id dasusr1
uid=500(dasusr1) gid=101(dasadm1) groups=101(dasadm1)
[root@db2 ~]# id db2fenc1
uid=502(db2fenc1) gid=103(db2fadm1) groups=103(db2fadm1)
设置密码:
passwd db2inst1
passwd db2fenc1
passwd db2das1
创建实例
#cd /opt/ibm/db2/V10.5/instance
#./dascrt -u db2das1
#./db2icrt -u db2inst1 db2inst1
Dascrt:创建的是DB2 adminstration server,每台服务器只有一个这种server,为进行DB2管理(比如运行控制中心)所必须,同时指定其管理用户是db2das。
db2icrt:创建的是实例,其名字一般和管理用户名一样,这里均为db2inst1。
启动DB2
# su - db2das1
$ db2admin start ----启动DB2管理服务器
SQL4409W The DB2 Administration Server is already active.
$su - db2inst1
$ db2start ----启动数据库实例
05/07/2012 01:30:04 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
创建数据库
#su - db2inst1
$db2 create database test ----创建数据库实例
DB20000I The CREATE DATABASE command completed successfully.
连接到我们刚才创建的数据库
[root@db2 ~]# su - db2inst1
[db2inst1@db2 ~]$ db2
(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 10.5.5
You can issue database manager commands and SQL statements from the command
prompt. For example:
db2 => connect to sample
db2 => bind sample.bnd
For general help, type: ?.
For command help, type: ? command, where command can be
the first few keywords of a database manager command. For example:
? CATALOG DATABASE for help on the CATALOG DATABASE command
? CATALOG for help on all of the CATALOG commands.
To exit db2 interactive mode, type QUIT at the command prompt. Outside
interactive mode, all commands must be prefixed with 'db2'.
To list the current command option settings, type LIST COMMAND OPTIONS.
For more detailed help, refer to the Online Reference Manual.
db2 => connect to test
Database Connection Information
Database server = DB2/LINUXX8664 10.5.5
SQL authorization ID = DB2INST1
Local database alias = TEST
db2 => connect to test user db2inst1
Enter current password for db2inst1:
Database Connection Information
Database server = DB2/LINUXX8664 10.5.5
SQL authorization ID = DB2INST1
Local database alias = TEST
附录:
1.创建演示数据库
[db2inst1@db2 ~]$ 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.
2. 访问创建的演示数据库
[db2inst1@db2 ~]$ db2
db2 => connect to sample
Database Connection Information
Database server = DB2/LINUXX8664 10.5.5
SQL authorization ID = DB2INST1
Local database alias = SAMPLE
db2 => list tables
Table/View Schema Type Creation time
------------------------------- --------------- ----- --------------------------
ACT DB2INST1 T 2015-04-17-11.20.56.982391
ADEFUSR DB2INST1 S 2015-04-17-11.20.59.928583
CATALOG DB2INST1 T 2015-04-17-11.21.05.848283
CL_SCHED DB2INST1 T 2015-04-17-11.20.54.496885
CUSTOMER DB2INST1 T 2015-04-17-11.21.04.895452
DEPARTMENT DB2INST1 T 2015-04-17-11.20.54.740082
DEPT DB2INST1 A 2015-04-17-11.20.55.388459
EMP DB2INST1 A 2015-04-17-11.20.55.630724
EMPACT DB2INST1 A 2015-04-17-11.20.56.981067
EMPLOYEE DB2INST1 T 2015-04-17-11.20.55.389943
EMPMDC DB2INST1 T 2015-04-17-11.21.00.560011
EMPPROJACT DB2INST1 T 2015-04-17-11.20.56.865924
EMP_ACT DB2INST1 A 2015-04-17-11.20.56.981810
EMP_PHOTO DB2INST1 T 2015-04-17-11.20.55.631266
EMP_RESUME DB2INST1 T 2015-04-17-11.20.56.071402
INVENTORY DB2INST1 T 2015-04-17-11.21.04.572625
IN_TRAY DB2INST1 T 2015-04-17-11.20.57.103931
ORG DB2INST1 T 2015-04-17-11.20.57.175418
PRODUCT DB2INST1 T 2015-04-17-11.21.03.733860
3.常用操作命令
db2 =>connect to sample ---连接到sample数据库
db2 =>list tables ---查看库下面的所有表
db2 => select * from staff wheredept=10 ---查询某张表dept等于10的所有记录
db2 => quit ---退出db2
DB20000I The QUIT command completed successfully.
$ db2ilist; ---查看实例列表
db2inst1
$ db2 get instance ---查看当前所运行的实例
Thecurrent database manager instance is: db2inst1