Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1114012
  • 博文数量: 309
  • 博客积分: 6093
  • 博客等级: 准将
  • 技术积分: 3038
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-03 17:14
个人简介

linux学习记录

文章分类

全部博文(309)

文章存档

2014年(2)

2012年(37)

2011年(41)

2010年(87)

2009年(54)

2008年(88)

分类:

2011-05-06 17:16:30

DB2基础学习三 DB2安装

来自:推动者社区 推动者社区




本节其我们开始学习DB2相关的管理技术,还是从安装开始讲起,本例以AIX平台为基础,由于版面字数限制,刚开始很全面的发表失败,由于未备份只能重新开始来,本讲就简化,注重安装过程,至于为什么会这样,下一讲讲重点介绍。
DB2安装需要的硬件环境要求:磁盘和内存要求磁盘要求产品需要的磁盘空间取决于所选择的安装类型以及具有的文件系统类型。“DB2® 安装”向导会根据在典型安装、精简安装或定制安装过程中选择的组件,提供动态的大小估计。
请记住,应包括必需的数据库、软件和通信产品所需要的磁盘空间。
在 Linux® 和 UNIX® 操作系统上,建议 /tmp 目录中有 2 GB 可用空间。
内存要求DB2 数据库系统至少需要 256 MB RAM。对于一个只运行 DB2 产品和 DB2 GUI 工具的系统,至少需要 512 MB RAM。但是,建议提供 1 GB 的 RAM 以提高性能。这些要求并不包括在系统上运行的其他软件所需要的内存。
当确定内存要求时,应了解下列事项:
  • 在基于 Itanium 的 HP-UX V11i 系统上运行的 DB2 产品至少需要 512 MB RAM。
  • 对于 IBM® 数据服务器客户机支持,这些内存要求是按照存在五个并行客户机连接的情况来计算的。每增加五个客户机连接,就需要增加 16 MB RAM。
  • 内 存要求不仅受到数据库系统大小和复杂程度的影响,而且受到数据库活动范围和访问系统的客户机数目的影响。 对于 DB2 服务器产品,自调整内存功能会自动设置几个内存配置参数值,从而简化了内存配置任务。启用此功能后,内存调整器就会在几个内存使用者(包括排序、程序包高 速缓存、锁定列表和缓冲池)之间动态分配可用内存资源。
  • 在 Linux 和 UNIX 操作系统上,建议使 SWAP 空间至少为 RAM 的两倍。

配置 AIX 系统参数
AIX 操作系统在安装完成后,系统的许多默认参数需要手工来修改这些参数,为提高 DB2 数据库的性能。需要调整以下参数,
需要首先以 root 用户身份登陆。
设置每个用户的最大进程数 # chdev -l sys0 -a maxuproc='4096'
设置文件的缓存
DB2 数据库有自己的文件缓存,一般情况下不需要使用系统的文件缓存。在 AIX 系统中,默认情况,系统的文件缓存设置的过大,
影响了 DB2 使用更多的系统内存。这里通过 vmo 命令限制 AIX 系统的文件缓存大小,分别为最小为 15%,最大为系统的 40%。
在进行调整前,首先通过命令 vmo -a 来查看目前的参数值;minperm 及 maxperm 的缺省值分别是 30% 和 80%。
# vmo –p –o minperm% = 15
# vmo –p –o maxperm% = 40
设置系统的 Paging Space
AIX 安装完成后,默认的 Paging Space 的大小为 512MB,需要设置其他,设置 Paging Space 的大小的原则是 :
   1) 系统实际内存在 64MB to 256MB 之间 , Page Space = RAM size + 16MB ;
   2) 系统实际内存大于 256MB , Page Space = 512 + ( RAM - 256 ) * 1.25 ;
   3) 当内存超过 4GB 时 , 则需要根据实际情况来定,一般可初始 3GB, 然后观察 Paging Space 的使用情况 ,
  如果使用率超过 70%, 则需要增加 paging space。可以通过 chps 命令直接修改或 smitty chps 来修改。
  # chps -s 16 hd6  ( 系统的 PPS 大小为 128M)
操作系统补丁要求  
AIX V5.3
需要 64 位 AIX 内核
AIX 5.3 技术级别(TL)9 和 Service Pack(SP?)2
最低 C++ 运行时级别需要 xlC.rte 9.0.0.8 和 xlC.aix50.rte 9.0.0.8(或更高版本)文件集。
这些文件集包含在 2008 年 6 月发布的“用于 AIX 的 IBM? C++ 运行时环境组件”程序包中。
AIX V6.12
需要 64 位 AIX 内核
AIX 6.1 TL 2
最低 C++ 运行时级别需要 xlC.rte 9.0.0.8 和 xlC.aix61.rte 9.0.0.8(或更高版本)文件集。
这些文件集包含在 2008 年 6 月发布的“用于 AIX 的 IBM C++ 运行时环境组件”程序包中。
安装IOCP,smitty installp
smitty iocp,将IOCP改为available重启。

安装数据库过程


1、安装介质准备

   通过ftp将db2安装介质和License文件传到AIX系统里。

# pwd
/software

# ls
DB2_Enterprise_Svr_Ed_AIX_5L_v91.tar  db2_install                           installFixPack                        db2  
aix5300-07                            db2setup                              lost+found


2、安装DB2产品

   以root用户执行:

# ./db2_install

Default directory for installation of products - /opt/IBM/db2/V9.1
***********************************************************
Do you want to choose a different directory to install [yes/no] ?
no


Specify one or more of the following keywords,
separated by spaces, to install DB2 products.
  CLIENT
  RTCL
  ESE

Enter "help" to redisplay product names.
Enter "quit" to exit.
***********************************************************
ESE
DB2 installation is being initialized.

Total number of tasks to be performed: 45
Total estimated time for all tasks to be performed: 826

Task #1 start
Description: Enabling Asynchronous I/O
Estimated time 2 second(s)
Task #1 end

Task #2 start
Description: Checking license agreement acceptance
Estimated time 1 second(s)
Task #2 end

Task #3 start
Description: GSKit support
Estimated time 19 second(s)
Task #3 end

Task #4 start
Description: Product Messages - English
Estimated time 10 second(s)
Task #4 end

Task #5 start
Description: Base client support
Estimated time 131 second(s)
Task #5 end

Task #6 start
Description: IBM Software Development Kit (SDK) for Java(TM)
Estimated time 81 second(s)
Task #6 end

Task #7 start
Description: Java Help (HTML) - English
Estimated time 7 second(s)
Task #7 end

Task #8 start
Description: Replication with MQ Server
Estimated time 23 second(s)
Task #8 end

Task #9 start
Description: Run-time Environment
Estimated time 87 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 41 second(s)
Task #11 end

Task #12 start
Description: SQL Replication Support
Estimated time 21 second(s)
Task #12 end

Task #13 start
Description: Base server support
Estimated time 48 second(s)
Task #13 end

Task #14 start
Description: Connect support
Estimated time 3 second(s)
Task #14 end

Task #15 start
Description: Java support
Estimated time 6 second(s)
Task #15 end

Task #16 start
Description: Java Common files
Estimated time 19 second(s)
Task #16 end

Task #17 start
Description: Spatial Extender client
Estimated time 6 second(s)
Task #17 end

Task #18 start
Description: Base application development tools
Estimated time 18 second(s)
Task #18 end

Task #19 start
Description: Administration Server
Estimated time 7 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: Parallel Extension
Estimated time 3 second(s)
Task #21 end

Task #22 start
Description: Replication tools
Estimated time 13 second(s)
Task #22 end

Task #23 start
Description: Relational wrappers common
Estimated time 3 second(s)
Task #23 end

Task #24 start
Description: DB2 data source support
Estimated time 8 second(s)
Task #24 end

Task #25 start
Description: DB2 LDAP support
Estimated time 4 second(s)
Task #25 end

Task #26 start
Description: DB2 Instance Setup wizard
Estimated time 4 second(s)
Task #26 end

Task #27 start
Description: Control Server
Estimated time 3 second(s)
Task #27 end

Task #28 start
Description: XML Extender
Estimated time 10 second(s)
Task #28 end

Task #29 start
Description: First Steps
Estimated time 3 second(s)
Task #29 end

Task #30 start
Description: DB2 Web Tools
Estimated time 12 second(s)
Task #30 end

Task #31 start
Description: Product Signature for DB2 Enterprise Server Edition
Estimated time 6 second(s)
Task #31 end

Task #32 start
Description: XML Extender samples
Estimated time 3 second(s)
Task #32 end

Task #33 start
Description: ADT sample programs
Estimated time 21 second(s)
Task #33 end

Task #34 start
Description: Sample database source
Estimated time 4 second(s)
Task #34 end

Task #35 start
Description: Spatial Extender samples
Estimated time 3 second(s)
Task #35 end

Task #36 start
Description: Informix data source support
Estimated time 5 second(s)
Task #36 end

Task #37 start
Description: Setting DB2 library path
Estimated time 120 second(s)
Task #37 end

Task #38 start
Description: Executing control tasks
Estimated time 20 second(s)
Task #38 end

Task #39 start
Description: Updating global registry
Estimated time 20 second(s)
Task #39 end

Task #40 start
Description: Starting DB2 Fault Monitor
Estimated time 10 second(s)
Task #40 end

Task #41 start
Description: Updating the db2ls link
Estimated time 1 second(s)
Task #41 end

Task #42 start
Description: Registering DB2 licenses
Estimated time 5 second(s)
Task #42 end

Task #43 start
Description: Setting default global profile registry variables
Estimated time 1 second(s)
Task #43 end

Task #44 start
Description: Initializing instance list
Estimated time 5 second(s)
Task #44 end

Task #45 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #45 end

The execution completed successfully.

For more information see the DB2 installation log at
"/tmp/db2_install.log.340158".

3、安装License。

  以root用户执行:

# cd /opt/IBM/db2/V9.1/adm

# ./db2licm -a  /tmp/license/db2ese_c.lic

LIC1402I License added successfully.  

如果还有其他license,可以在一并添加。

至此,DB2产片安装完成。


4、创建DB2组和用户

创建用户的Home:

# mkdir /home/db2inst1

# mkdir /home/db2fenc1

# mkdir /home/dasusr1

创建组:

# mkgroup -A id=117  db2iadm1

# mkgroup -A id=118  db2fadm1

# mkgroup -A id=119  dasadm1

创建用户:

# mkuser -a id=221 pgrp=dbiadm1 home=/home/db2inst1 db2inst1
# mkuser -a id=222 pgrp=db2fadm1 home=/home/db2fenc1 db2fenc1
# mkuser -a id=223 pgrp=dasadm1  home=/home/db2adm1 dasusr11

修改用户密码:

# passwd db2inst1
Changing password for "db2inst1"
db2inst1's New password:
Enter the new password again:
# passwd db2fenc1
Changing password for "db2fenc1"
db2fenc1's New password:
Enter the new password again:
# passwd db2adm1
Changing password for "db2adm1"
db2adm1's New password:
Enter the new password again:


5、创建实例和数据库

  以root用户执行:

# cd /opt/IBM/db2/V9.7
# ls
.metadata     bin           das           doc           include32     java          map           samples       tools
Readme        bnd           dasfcn        function      infopop       lib32         misc          security32
adm           cfg           db2xml        ha            install       lib64         msg           security64
adsm          conv          default.env   include       instance      license       profiles.reg  tivready
# cd instance
# ls
common      daslist     dasutil     db2iauto    db2idbm     db2iexec    db2imchk    db2ipcld    db2isrv     db2iuadm    db2uit
dascrt      dasmigr     db2ckmig    db2icknm    db2idefs    db2iinfo    db2imigr    db2iset     db2istop    db2iupdt    native
dasdrop     dasupdt     db2clpid    db2icrt     db2idrop    db2ilist    db2instcfg  db2isetup   db2istrt    db2iutil
# ./db2icrt -p 50000 -u db2fenc1 db2inst1
DBI1070I Program db2icrt completed successfully.  


创建样本数据库:

# su - db2inst1
$ db2sampl

  Starting the DB2 instance...
  Creating database "SAMPLE"...
  Connecting to database "SAMPLE"...
  Creating tables and data in schema "DB2INST1"...
  Stopping the DB2 instance...

  'db2sampl' processing complete.

$ db2 list db directory

System Database Directory

Number of entries in the directory = 1

Database 1 entry:

Database alias                       = SAMPLE
Database name                        = SAMPLE
Local database directory             = /home/db2inst1
Database release level               = b.00
Comment                              = A sample database
Directory entry type                 = Indirect
Catalog database partition number    = 0
Alternate server hostname            =
Alternate server port number         =

$ db2 connect to sample
SQL1032N  No start database manager command was issued.  SQLSTATE=57019
$ db2start
12/23/2009 18:14:48     0   0   SQL1063N  DB2START processing was successful.
SQL1063N  DB2START processing was successful.

$ db2 connect to sample

   Database Connection Information

Database server        = DB2/AIX64 9.7
SQL authorization ID   = DB2INST1
Local database alias   = SAMPLE

$ 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.

$ db2licm -l
Product name:                     "DB2 Enterprise Server Edition"
License type:                     "User"
Expiry date:                      "Permanent"
Product identifier:               "db2ese"
Version information:              "9.7"
Number of licensed authorized users: "25"
Annotation:                       "-2;(_u)"
Features:
DB2 Database Partitioning:        "Not licensed"
DB2 Performance Optimization ESE: "Not licensed"
DB2 Storage Optimization:         "Not licensed"
DB2 Advanced Access Control:      "Not licensed"
DB2 Geodetic Data Management:     "Not licensed"
Homogeneous Federation for DB2:   "Not licensed"
DB2 Pure XML ESE:                 "Not licensed"

6、创建DAS管理服务器
  以root用户执行:
# pwd
/opt/IBM/db2/V9.7/instance
# ./dascrt -u dasusr1
SQL4406W  The DB2 Administration Server was started successfully.
DBI1070I Program dascrt completed successfully.  
# su - dasusr1
$ db2admin
db2adm1
$ db2admin start
SQL4409W  The DB2 Administration Server is already active.
$ exit
# su - db2inst1
$ ls
db2inst1  sqllib
$  db2 get dbm cfg|grep SVCENAME
TCP/IP Service name                          (SVCENAME) = 50000
以上一个完整的安装过程即完成,各个安装细节问题下节继续讨论。
阅读(1112) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~