在AIX上安装分区DB2服务器
正确的设置OS的时间和时区,如果以后发生更改可能导致DB2产生0440的错误。4月英文缩写
1,更新分区DB2安装的AIX环境设置
1,1作为root用户登录
chdev -l sys0 -a maxuproc='4096'
AIX 5.2:
使用vmtune
maxperm = 20
minperm = 10
AIX 5.3:
vmo -po maxperm%=30
vmo -po maxclient%=30
vmo -po minperm%=10
vmo -p -o lru_file_repage=0 -o minperm%=3 -o maxperm%=15 -o maxclient%=15 -o minfree=8000 -o maxfree=8512
ioo -p -o j2_minPageReadAhead=32 -o j2_maxPageReadAhead=512 -o j2_nBufferPerPagerDevice=2048 -o lvm_bufcnt=16 -o minpgahead=128 -o maxpgahead=512 -o pv_min_pbuf=1024
no -p -o sb_max=1310720 -o rfc1323=1 -o ipqmaxlen=250 -o udp_ndspace=65536 -o udp_recvspace=65536 -o tcp_ndspace=221184 -o tcp_recvspace=221184 -o tcp_mssdflt=1440 -o tcp_nodelayack=1
ulimit -n unlimited
ulimit -d unlimited
ulimit -f unlimited
export AIXTHREAD_SCOPE=S
tcpip参数设置
勤奋的图片
no -o thewall=65536
no -o sb_max=1310720
no -o rfc1323=1
no -o tcp_ndspace=221184
no -o tcp_recvspace=221184
no -o udp_ndspace=65536
no -o udp_recvspace=65536
宝马铁西工厂no -o ipqmaxlen=250
no -o somaxconn=1024
列出所有网络相关参数的当前设置使用;
no -a |more
要设置参数,使用:
no -o parameter=value
如果使用高速互联,则必须把css0的spoolsize和rpoolsize设置为下列值:
spoolsize 16777216
rpoolsize 16777216
芒福德确保有足够的调页空间:
lsps -a
网络文件系统守护进程(NFSD)的数目应该接近于:
# of biod on a computer * # of computers in the instance
建议在每台计算机上运行10个BIOD进程,者由4台计算机组成的系统将使用40个NFSD。
验证NFS是否运行
lssrc -g nfs
保证
rpc.lockd 和 rpc.statd是活动的。
创建NFS方式导出和NFS方式导入的文件系统
创建nfs文件系统 smitty jfs
导出nfs文件系统 smitty nfs
在每台计算机上导入NFS文件系统 smitty nfs
2,创建用户和用户组
mkgroup id=989 db2iadm
mkgroup id=988 db2fadm
mkgroup id=987 db2asgp
mkur id=1014 pgrp=db2iadm groups=db2iadm home=/db2inst/db2inst1 core=-1 data=491519 stack=32767 rss=-1 fsize=-1 db2inst1
mkur id=1013 pgrp=db2fadm groups=db2fadm home=/db2inst/db2fenc db2fenc
mkur id=1012 pgrp=db2asgp groups=db2asgp home=/db2inst/db2as db2as
passwd db2inst
passwd db2fenc
passwd db2as
chur capabilities="CAP_BYPASS_RAC_VMM,CAP_PROPAGATE" db2inst1
在所有计算机上创建相同的用户和组
产生实例:考虑32位还是64位,根据操作系统来。
db2icrt -s e -w 64 -u db2fenc db2inst1
v91: db2icrt -s e -u db2fenc db2inst1
dascrt -u <DASUr> 需要root权限
dascrt -u db2as
db2t DB2COMM=tcpip
db2t DB2CODEPAGE=1386
为了增加DB2的并发性可以设置如下注册变量:
db
2t DB2_SKIPDELETED=on
db2t DB2_SKIPINSERTED=on
db2t DB2_EVALUNCOMMITTED=on
db2t DB2MEMDECLAIM=YES
db2t DB2_LARGE_PAGE_MEM=DB
db2t DB2_PINNED_BP=YES
3,安装CD-ROM
mkdir /cdrom -p
crfs -v cdrfs -p ro -d cd0 -m /cdrom
mount /cdrom
4, 分区db2服务器的安装和设置(UNIX)
安装DB2
选择产生响应文件
分区实例
在每一台计算机上安装db2
在每台计算机上安装DB2 licen:
db2licm -a db2e.lic
4,1更改节点配置文件
db2nodes.cfg
4,2 启用远程执行
.rhosts
4,3 安装DB2补丁
./installFixPak -a
对每一个实例
INSTHOME/instance/db2iupdt iname
INSTHOME/instance/dasupdt dasname
对每个数据库,re-binding bind files
At the DB2 command line, enter:
TERMINATE
CONNECT TO <dbname>
BIND <path>/@db2ubind.lst BLOCKING ALL GRANT PUBLIC
BIND <path>/@db2cli.lst BLOCKING ALL GRANT PUBLIC
TERMINATE
Re-binding specific packages
At the DB2 command line, enter:
TERMINATE
CONNECT TO <dbname>
BIND <path>/<bind_file> BLOCKING ALL GRANT PUBLIC sqlerror continue
TERMINATE
where <bind_file> reprents the name of the bind file, and <dbname>
reprents the name of your databa.
Binding databa utilities using the Run-Time Client
The Run-Time Client cannot be ud to bind the databa utilities
(import, export, reorg, the Command Line Processor) and DB2 CLI bind
files. You must u the DB2 Administration Client or the DB2 Application
Development Client instead.
You must bind the databa utilities (import, export, reorg, the Command
Line Processor) and DB2 CLI bind files to each databa before they can
be ud with that databa. In a network environment, if you are using
multiple clients that run on different operating systems or that are at
different DB2 version or rvice levels, you must bind the utilities
once for each operating system and DB2 client-version combination.
Bind db2schema.bnd to existing databas
After installation on the rver, an additional bind file needs to be
bound to existing databas. This requirement does not apply to clients.
Procedure
To bind db2schema.bnd on the rver, execute one of the command
quences:
班主任工作艺术
At a command prompt:
db2 terminate
db2 CONNECT TO <dbname>
db2 BIND <path>/db2schema.bnd BLOCKING ALL GRANT PUBLIC sqlerror continue
db2 terminate
or,
At the DB2 command line:
TERMINATE
CONNECT TO <dbname>
BIND <path>/db2schema.bnd BLOCKING ALL GRANT PUBLIC sqlerror continue
TERMINATE
where <dbname> reprents the name of a databa to which the utilities
should be bound, and where <path> is the full path name of the directory
where the bind files are located.
4,4 验证分区数据库服务器的安装
db2sampl
db2 connect to sample
db2 "lec
t * from staff where dept = 20"
lect distinct dbpartitionnum(empno) from employee;
5,1 对所有的分区进行操作
db2_all "db2 connect to sample"
验证是否所有分区都可以正常连接。
微观环境分析6,FCM 参数配置
在db2nodes.cfg文件中定义的每个分区都会启动一个FCM daemon(db2fcmdm)。此进程用于在
各分区之间传递数据。只有一个分区不需要FCM daemon。
每个分区会产生一个DBMS(databa manager shared memory t)。包含实例信息。
FCM SHARED MEMORY SEGMENT
Parameter:
FCM_NUM_BUFFERS
用于AGENTS之间的数据传输。4K 页面。可动态调整。
FCM_NUM_RQB
FCM request blocks 数目。As the name implies, a request
block is ud any time an agent wants to nd some information to another
agent. The agent must t up an FCM buffer with the data it wants to nd,
拱式桥
and then make a “request” to nd this information.
FCM_NUM_CONNECT hidden until fixpack 5.
Together with a request block, this structure acts to uniquely define a
particular connection path between agents for the purpo of nding row
information back and forth.There is a performance overhead of creating
this connection information every time agents need to flow rows back and
forth on behalf of some SQL issued by the application (for example, a join
between partitions).
FCM_NUM_ANCHORS hidden until fixpack 5.
Together with a request block, this structure acts to uniquely define a
particular connection path between agents for the purpo of nding
internal control information messages between agents. This FCM resource
maintains the communication path between the agents.
INTRA_PARALLEL
This is an On/Off type of parameter that will turn On/Off the intra-partition
parallelism feature. With this intra-partition parallelism turned on, a single
transaction can be divided into smaller parts, and each part can be
executed in parallel thus providing a performance benefit.
This is not an FCM parameter, but we mention it here becau if a single
partition instance has this intra-partition parallelism enabled, FCM will still
be ud to pass information between subagents on the single partition.
6,2 db2 registry ttings
DB2_NUM_FAILOVER_NODES
Specifies the number of partitions that can be ud as failover partitions in a
high availability environment.For example, suppo the db2nodes.cfg has host A with partitions 1 and 2,
and host B with partitions 3 and 4. Then, host B fails over to host A. Now,
host A will have partitions 1, 2, 3, and 4. For this to work properly, host A
needed to have enough shared memory pre-allocated to handle the two
new partitions. In this ca, a tting of 2 or more would work.
DEFAULT IS 2
DB2_FORCE_FCM_BP
This parameter applies to AIX only. For DB2 on all other UNIX systems,
DB2 behaves as if this parameter was
turned on. It is a Yes/No type of
parameter.
With this parameter turned on, communication between logical databa
partitions will be done via shared memory (as oppod to TCP/IP, and
thereby bypassing the FCM daemon). Tests have shown a 30%
performance increa for inter-partition communication between logical
databa partitions with this parameter turned on. DEFAULT IS NO ON AIX
6,3 CONFIGURE EXAMPLE
Example #1:
If this is AIX with the DB2_FORCE_FCM_BP parameter turned on, or if this is a non-AIX
UNIX platform like Sun/HP/Linux, then DB2 will create a single shared memory gment solely
for the purpo of holding the FCM resources on each physical machine defined in the
db2nodes.cfg. All logical partitions on the given physical machine will share this FCM gment.
(Recall that DB2_FORCE_FCM_BP only applies to AIX, and that non-AIX platforms behave as
if this parameter was always turned on.)
在每台物理机器上只有一个FCM共享内存段。可以减少内存的使用,提高性能。
$ ipcs –ma 观察共享内存段
$ db2_all "db2pd -inst -memts"
EXAMPLE 2
In the ca where DB2_FORCE_FCM_BP=OFF, DB2 will not create a shared memory
gment just for FCM. Instead, the FCM resources will be stored in the databa manager shared
memory t (DBMS). This gment is always created at db2start time regardless of the tting
contractfor DB2_FORCE_FCM_BP, since this is the gment that holds all of the instance memory for
the partition.
每个分区有自己的DBMS,所以通讯是使用UNIX domain sockets。
The DBMS gment is ud for other purpos besides FCM resources. If the configured
ttings for FCM resources are large enough such that they will not be able to fit into the
DBMS gment, then DB2 will allocate the FCM gment just as if
DB2_FORCE_FCM_BP were turned on. The limitation we are referring to here is that
memory gments can only be a maximum of 256 MB on AIX in the 32-bit model.
--Chongqing telecom edw create db
create databa cqedw on /db2data using codet GBK territory CN COLLATE USING IDENTITY
CATALOG TABLESPACE MANAGED BY databa USING
(device '/dev/rlvdb2syscat_01' 1047040)
EXTENTSIZE 16 PREFETCHSIZE 32
--create db partition group
CREATE DATABASE PARTITION GROUP MAXGROUP ON ALL DBPARTITIONNUMS
--change system temporary tablespace
CREATE SYSTEM TEMPORARY TABLESPACE TEMPSYS_TBSP1
IN DATABASE PARTITION GROUP IBMTEMPGROUP
PAGESIZE 4 K MANAGED BY databa
using (device '/dev/rlvdbtmp_01n00' 5505024) on dbpartitionnum(0)
using (device '/dev/rlvdbtmp_01n01' 5505024) on dbpartitionnum(1)
using (device '/dev/rlvdbtmp_01n02' 5505024) on dbpartitionnum(2)
using (device '/dev/rlvdbtmp_01n03' 5505024) on dbpartitionnum(3)
using (device '/dev/rlvdbtmp_01n04' 5505024) on dbpartitionnum(4)
using (device '/dev/rlvdbtmp_01n05' 5505024) on dbpartitionnum(5)
using (device '/dev/rlvdbtmp_01n06' 55050
24) on dbpartitionnum(6)
using (device '/dev/rlvdbtmp_01n07' 5505024) on dbpartitionnum(7)
EXTENTSIZE 16 OVERHEAD 10.5 PREFETCHSIZE 32
DROP TABLESPACE tempspace1
--create ur temporary tablespace
-
-CREATE USER TEMPORARY TABLESPACE USER_TEMP_TBSP
-- IN DATABASE PARTITION GROUP MAXGROUP
-- PAGESIZE 4 K MANAGED BY SYSTEM
-- USING ('D:\testdbtbs\ur_temp_0' ) ON DBPARTITIONNUM (0)
-- USING ('d:\testdbtbs\ur_temp_1' ) ON DBPARTITIONNUM (1)
--create db partition group single_grp,create dim tablespace on it
CREATE DATABASE PARTITION GROUP single_grp ON DBPARTITIONNUM(4)
CREATE TABLESPACE dim_tbs IN DATABASE PARTITION GROUP single_grp pagesize 4k MANAGED BY DATABASE USING (device '/dev/rlvdb2dim_01' 3932160)
--create bufferpools
alter bufferpool IBMDEFAULTBP size 128000
create bufferpool bp_32k immediate all dbpartitionnums size 32000 pagesize 32768
--update dbm and db configure parameters
--dbm cfg
db2 update dbm cfg using SHEAPTHRES 3000000
db2 update dbm cfg using FCM_NUM_BUFFERS 25600
--db cfg
--u db2_all to execute
db2_all "db2 connect to cqedw;db2 update db cfg for cqedw using DBHEAP 10000"
db2_all "db2 connect to cqedw;db2 update db cfg for cqedw using LOGBUFSZ 4096"
db2_all "db2 connect to cqedw;db2 update db cfg for cqedw using UTIL_HEAP_SZ 10000 "
db2_all "db2 connect to cqedw;db2 update db cfg for cqedw using LOCKLIST 10000"
db2_all "db2 connect to cqedw;db2 update db cfg for cqedw using SORTHEAP 40000"
db2_all "db2 connect to cqedw;db2 update db cfg for cqedw using STMTHEAP 4096"
db2_all "db2 connect to cqedw;db2 update db cfg for cqedw using APPLHEAPSZ 128"
db2_all "db2 connect to cqedw;db2 update db cfg for cqedw using MAXLOCKS 40"
db2_all "db2 connect to cqedw;db2 update db cfg for cqedw using CHNGPGS_THRESH 20"
db2_all "db2 connect to cqedw;db2 update db cfg for cqedw using NUM_IOSERVERS 5"
db2_all "db2 connect to cqedw;db2 update db cfg for cqedw using LOGFILSIZ 25600"
db2_all "db2 connect to cqedw;db2 update db cfg for cqedw using LOGPRIMARY 20"
db2_all "db2 connect to cqedw;db2 update db cfg for cqedw using LOGSECOND 30"