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的大小的原则是 :
操作系统补丁要求
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、安装介质准备
# pwd
/software
# ls
DB2_Enterprise_Svr_Ed_AIX_5L_v91.tar
aix5300-07
2、安装DB2产品
# ./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.
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。
# cd /opt/IBM/db2/V9.1/adm
# ./db2licm-a
LIC1402I License addedsuccessfully.
如果还有其他license,可以在一并添加。
至此,DB2产片安装完成。
4、创建DB2组和用户
创建用户的Home:
# mkdir /home/db2inst1
# mkdir /home/db2fenc1
# mkdir /home/dasusr1
创建组:
# mkgroup -Aid=117
# mkgroup -Aid=118
# mkgroup -Aid=119
创建用户:
# mkuser -a id=221 pgrp=dbiadm1 home=/home/db2inst1db2inst1
# mkuser -a id=222 pgrp=db2fadm1 home=/home/db2fenc1 db2fenc1
# mkuser -a id=223pgrp=dasadm1
修改用户密码:
# 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、创建实例和数据库
# cd /opt/IBM/db2/V9.7
# ls
.metadata
Readme
adm
adsm
# cd instance
# ls
common
dascrt
dasdrop
# ./db2icrt -p 50000 -u db2fenc1 db2inst1
DBI1070I Program db2icrt completedsuccessfully.
创建样本数据库:
# su - db2inst1
$ db2sampl
$ db2 list db directory
System Database Directory
Number of entries in the directory = 1
Database 1 entry:
Database alias
Database name
Local database directory
Database release level
Comment
Directory entry type
Catalog database partition number
Alternate server hostname
Alternate server port number
$ db2 connect to sample
SQL1032N
$ db2start
12/23/2009 18:14:48
SQL1063N
$ db2 connect to sample
Database server
SQL authorization ID
Local database alias
$ db2 "select * from staff"
ID
------ --------- ------ ----- ------ --------- ---------
$ db2licm -l
Product name:
License type:
Expiry date:
Product identifier:
Version information:
Number of licensed authorized users: "25"
Annotation:
Features:
DB2 Database Partitioning:
DB2 Performance Optimization ESE: "Not licensed"
DB2 Storage Optimization:
DB2 Advanced Access Control:
DB2 Geodetic Data Management:
Homogeneous Federation for DB2:
DB2 Pure XML ESE:
# pwd
/opt/IBM/db2/V9.7/instance
# ./dascrt -u dasusr1
SQL4406W
DBI1070I Program dascrt completedsuccessfully.
# su - dasusr1
$ db2admin
db2adm1
$ db2admin start
SQL4409W
$ exit
# su - db2inst1
$ ls
db2inst1
$
TCP/IP Service name
以上一个完整的安装过程即完成,各个安装细节问题下节继续讨论。