1,为db数据文件创建空间
mkdir -p /db2root/testdb/lv_db2db
mkdir -p /db2root/testdb/lv_db2index
mkdir -p /db2root/testdb/lv_db2log
mkdir -p /db2root/testdb/lv_systbs
mkdir -p /db2root/testdb/lv_temptbs
touch /db2root/testdb/lv_usertbs
chown -R db2inst1:db2grp1 /db2root/testdb
2,在实例用户下建库(db2模式下)
create database testdb on /db2root/testdb/lv_db2db using codeset GBK territory zh_CN collate using identity catalog tablespace managed by system using ('/db2root/testdb/lv_systbs/catalog') TEMPORARY tablespace managed by system using ('/db2root/testdb/lv_temptbs/temporary') user tablespace managed by database using(file '/db2root/testdb/lv_usertbs' 2621440)
3,设置db参数
connect to testdb
update db cfg for mmscdb using newlogpath /db2root/testdb/lv_db2log logprimary 20 logfilsiz 7680
update db cfg using STMTHEAP 16384
update db cfg using STMTHEAP 16384
update db cfg using APPLHEAPSZ 512
4,授权用户user1
connect to testdb user db2inst1 using passwd
grant use of tablespace USERSPACE1 to user user1
grant dbadm on database to user user1