1. 运行 ./db2cc, db2 control center打不开
solution:
# xhost +
then run ./db2cc again.
2. db2 cmd
su db2inst1 (切换到DB2用户)
./db2 (启动DB2)
connect to $dbname (连接到数据库)
3. 删除输错的命令
直接按“ backspace”时会出现乱码,按“Ctrl+Alt+Backspace”可以删除
4. Create DB
CREATE DATABASE $databasename AUTOMATIC STORAGE YES ON '/home/db2inst1' DBPATH ON '/home/db2inst1' USING CODESET UTF-8 TERRITORY ZH_CN COLLATE USING SYSTEM PAGESIZE 4096
5.全过程:
1. 首先要切换到db2inst1帐户
su db2inst1
2. 切换到db2 bin文件夹
cd /opt/ibm/db2/V9.7/bin
3. 设置code page
db2set db2codepage=819
4. 创建数据库
db2 create database oxfamadm
5. 连接到数据库
db2 connect to oxfamadm
6. 创建bufferpool
db2 CREATE Bufferpool USER8 SIZE 100000 PAGESIZE 8K
db2 CREATE Bufferpool USER16 SIZE 1000 PAGESIZE 16 K
db2 CREATE Bufferpool USER32 SIZE 1000 PAGESIZE 32 K
7. 重启数据库
db2stop force
db2start
8. 连接到数据库
db2 connect to oxfamadm
9. 创建TABLE SPACE
db2 "CREATE REGULAR TABLESPACE TS_USER8 PAGESIZE 8K MANAGED BY SYSTEM USING ('FSMS_8K_1') BUFFERPOOL USER8"
db2 "CREATE REGULAR TABLESPACE TS_USER16 PAGESIZE 16K MANAGED BY SYSTEM USING ('FSMS_16K_1') BUFFERPOOL USER16"
db2 "CREATE REGULAR TABLESPACE TS_USER32 PAGESIZE 32K MANAGED BY SYSTEM USING ('FSMS_32K_1') BUFFERPOOL USER32"