rhel 6.2使用db2install安装DB2 v10.5

解压

[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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 217,509评论 6 504
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,806评论 3 394
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 163,875评论 0 354
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,441评论 1 293
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,488评论 6 392
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,365评论 1 302
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,190评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,062评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,500评论 1 314
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,706评论 3 335
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,834评论 1 347
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,559评论 5 345
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,167评论 3 328
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,779评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,912评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,958评论 2 370
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,779评论 2 354

推荐阅读更多精彩内容