一、建表空间和数据库
1.在db2ad、db2db和db2ap上均执行:
db2set db2comm=tcpip
db2set db2codepage=1386
2.新建数据库:
db2 create db using codeset gbk territory CN collate using identity
3.连接上数据库:
db2 "connect to "
4.创建缓冲池 + 建立表空间;
db2 drop tablespace tablespace1, tablespace2, tablespace3
2).新建缓冲池:
db2 create bufferpool bp32k all nodes size -1 pagesize 32k
bp32k为该缓冲池的名称;
db2 "create regular tablespace tablespace1 pagesize 32k managed by database using(file '/usr/yixiayizi/tablespace1' 5g) bufferpool bp32k"
db2 "create regular tablespace tablespace2 pagesize 32k managed by database using(file '/usr/yixiayizi/tablespace2' 10g) bufferpool bp32k"
db2 "create regular tablespace tablespace3 pagesize 32k managed by database using(file '/usr/yixiayizi/tablespace3' 2g) bufferpool bp32k"
注意(file '/usr/yixiayizi/tablespace1' 5g)的设置:
ALTER TABLESPACE RESIZE ( FILE '/cstp/usr/db2ad/db2ad/ ' 5g )
6.调整缓冲池大小:
db2 alter bufferpool bp32k size 2g
--------------------------------------------------------------------------------------------
db2 update dbm cfg using SVCENAME DB2_db2ad
这样在服务端实例对应的端口号就是60040;
db2 catalog tcpip node remote 172.17.252.214 server 60040
(上面操作的反编目:db2 uncatalog node db2 catalog db at node
(上面操作的反编目:db2 uncatalog db db2 "grant use of tablespace to user db2db"
db2 "grant use of tablespace to user db2db"
db2 "grant use of tablespace to user db2db"
二、建表
切换到db2db用户,执行建表的sql语句:
db2 -vf tmp.sql