--在db2cmd下先设置变量
db2set DB2_CREATE_DB_ON_PATH=YES
--创建数据库
CREATE DATABASE CCAS AUTOMATIC STORAGE NO ON 'E:\' USING CODESET GBK TERRITORY CN COLLATE USING SYSTEM PAGESIZE 32768;
--连接数据库
CONNECT TO CCAS;
--创建缓冲池
CREATE BUFFERPOOL BufferP32_CCAS IMMEDIATE SIZE 750 PAGESIZE 32 K;
--创建表空间(必须确保 E:\DB2\CCAS_SPACE 是空目录,或者该目录让系统自动创建)
CREATE REGULAR TABLESPACE CCAS_SPACE PAGESIZE 32 K MANAGED BY SYSTEM USING ('E:\DB2\CCAS_SPACE') EXTENTSIZE 32 OVERHEAD 10.5 PREFETCHSIZE 32 TRANSFERRATE 0.14 BUFFERPOOL BufferP32_CCAS DROPPED TABLE RECOVERY ON;
--创建系统临时表空间
CREATE SYSTEM TEMPORARY TABLESPACE CCAS_TEMPSPACE PAGESIZE 32 K MANAGED BY SYSTEM USING ('E:\DB2\CCAS_TEMPSPACE') EXTENTSIZE 32 OVERHEAD 10.5 PREFETCHSIZE 32 TRANSFERRATE 0.14 BUFFERPOOL BufferP32_CCAS;
--授权用户
GRANT CREATETAB,CONNECT ON DATABASE TO USER ccas_cq;
GRANT USE OF TABLESPACE CCAS_SPACE TO USER ccas_cq WITH GRANT OPTION;
CREATE SCHEMA ccas_cq AUTHORIZATION ccas_cq;
--连接重置
CONNECT RESET;