DB2 完整安装过程

DB2安装
本节其我们开始学习DB2相关的管理技术,还是从安装开始讲起,本例以AIX平台为基础,由于版面字数限制,刚开始很全面的发表失败,由于未备份只能重新开始来,本讲就简化,注重安装过程,至于为什么会这样,下一讲讲重点介绍。
DB2安装需要的硬件环境要求:磁盘和内存要求磁盘要求产品需要的磁盘空间取决于所选择的安装类型以及具有的文件系统类型。“DB2®安装”向导会根据在典型安装、精简安装或定制安装过程中选择的组件,提供动态的大小估计。
请记住,应包括必需的数据库、软件和通信产品所需要的磁盘空间。
在 Linux® 和 UNIX® 操作系统上,建议 /tmp 目录中有 2 GB 可用空间。
内存要求DB2 数据库系统至少需要 256 MB RAM。对于一个只运行 DB2 产品和 DB2 GUI 工具的系统,至少需要 512MB 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%, 则需要增加 pagingspace。可以通过 chps 命令直接修改或 smitty chps 来修改。
    # chps -s 16hd6    ( 系统的 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.rte9.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.rte9.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 ServerEdition
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 registryvariables
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 logat
"/tmp/db2_install.log.340158".

3、安装License。

  以root用户执行:

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

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

LIC1402I License addedsuccessfully.  

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

至此,DB2产片安装完成。


4、创建DB2组和用户

创建用户的Home:

# mkdir /home/db2inst1

# mkdir /home/db2fenc1

# mkdir /home/dasusr1

创建组:

# mkgroup -Aid=117  db2iadm1

# mkgroup -Aid=118  db2fadm1

# mkgroup -Aid=119  dasadm1

创建用户:

# mkuser -a id=221 pgrp=dbiadm1 home=/home/db2inst1db2inst1
# mkuser -a id=222 pgrp=db2fadm1 home=/home/db2fenc1 db2fenc1
# mkuser -a id=223pgrp=dasadm1  home=/home/db2adm1dasusr11

修改用户密码:

# 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 completedsuccessfully.  


创建样本数据库:

# su - db2inst1
$ db2sampl

  Starting theDB2 instance...
  Creating database"SAMPLE"...
  Connecting to database"SAMPLE"...
  Creating tables and data inschema "DB2INST1"...
  Stopping the DB2instance...

  '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 sampledatabase
Directory entry type            =Indirect
Catalog database partition number   = 0
Alternate server hostname         =
Alternate server port number       =

$ db2 connect to sample
SQL1032N  No start databasemanager command wasissued.  SQLSTATE=57019
$ db2start
12/23/2009 18:14:48      SQL1063N  DB2STARTprocessing was successful.
SQL1063N  DB2START processing wassuccessful.

$ db2 connect to sample

   DatabaseConnection Information

Database server      = DB2/AIX649.7
SQL authorization ID   =DB2INST1
Local database alias   =SAMPLE

$ db2 "select * from staff"

ID    NAME    DEPT  JOB  YEARS  SALARY   COMM    
------ --------- ------ ----- ------ --------- ---------
    10 Sanders      20Mgr        98357.50       -
    20 Pernal      20Sales      78171.25   612.45
    30 Marenghi     38Mgr        77506.75       -
    40 O'Brien      38Sales      78006.00   846.55
    50 Hanes       15Mgr     10  80659.80       -
    60 Quigley      38Sales      66808.30   650.25
    70 Rothman      15Sales      76502.83  1152.00
    80 James       20Clerk      43504.60   128.20
    90 Koonitz      42Sales      38001.75  1386.70
   100 Plotz       42Mgr        78352.80       -
   110 Ngan        15Clerk      42508.20   206.60
   120 Naughton     38Clerk      42954.75   180.00
   130Yamaguchi    42Clerk      40505.90    75.60
   140 Fraye       51Mgr        91150.00       -
   150 Williams     51Sales      79456.50   637.65
   160 Molinare     10Mgr        82959.20       -
   170 Kermisch     15Clerk      42258.50   110.10
   180 Abrahams     38Clerk      37009.75   236.50
   190 Sneider      20Clerk      34252.75   126.50
   200 Scoutten     42Clerk      41508.60    84.20
   210 Lu         10Mgr     10  90010.00       -
   220 Smith       51Sales      87654.50   992.80
   230Lundquist    51Clerk      83369.80   189.65
   240 Daniels      10Mgr        79260.25       -
   250 Wheeler      51Clerk      74460.00   513.30
   260 Jones       10Mgr     12  81234.00       -
   270 Lea        66Mgr        88555.50       -
   280 Wilson      66Sales      78674.50   811.50
   290 Quill       84Mgr     10  89818.00       -
   300 Davis       84Sales      65454.50   806.10
   310 Graham      66Sales    13  71000.00   200.30
   320 Gonzales     66Sales      76858.20   844.00
   330 Burke       66Clerk      49988.00    55.50
   340 Edwards      84Sales      67844.00  1285.00
   350 Gafney      84Clerk      43030.50   188.00

  35 record(s)selected.

$ db2licm -l
Product name:               "DB2Enterprise 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:      "Notlicensed"
DB2 Performance Optimization ESE: "Not licensed"
DB2 Storage Optimization:       "Notlicensed"
DB2 Advanced Access Control:     "Notlicensed"
DB2 Geodetic Data Management:    "Notlicensed"
Homogeneous Federation for DB2:  "Not licensed"
DB2 Pure XML ESE:            "Notlicensed"

6、创建DAS管理服务器
    以root用户执行:
# pwd
/opt/IBM/db2/V9.7/instance
# ./dascrt -u dasusr1
SQL4406W    The DB2 AdministrationServer was started successfully.
DBI1070I Program dascrt completedsuccessfully.   
# su - dasusr1
$ db2admin
db2adm1
$ db2admin start
SQL4409W    The DB2 AdministrationServer is already active.
$ exit
# su - db2inst1
$ ls
db2inst1    sqllib
  db2 get dbm cfg|grepSVCENAME
TCP/IP Service name                                    (SVCENAME) =50000
以上一个完整的安装过程即完成,各个安装细节问题下节继续讨论。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值