操作系统windowsXP
版本:9.1.7
一:db2安装
用户为当前操作系统得用户
域为空
二:添加许可证,因为当前系统得试用期已到,所以必须输入有效的序列号,在安装数据库的过程中有时候也会莫名的死掉,没关系,增加序列号就可以了
在控制中心的许可证中心添加:文件为安装目录中的db2ese.lic
三:启动数据库
Db2start
四:把db2安装目录下的文件夹sqllib设置为共享,此步骤必须做!!!
五:添加分区
(如果添加分区失败---〉 将SQLLIB\DB2\db2nodes.cfg中刚添加的分区节点删除掉)
并在0 zxt ZXT 0后增加1空行如下:
六:创建数据库
D:\dbsystmpconter\cont $N
CREATE DATABASE mydb ON 'D:' ALIAS mydb USING CODESET GBK TERRITORY CN COLLATE USING SYSTEM CATALOG TABLESPACE MANAGED BY SYSTEM USING ( 'D:\dbsysconter' ) EXTENTSIZE 32 PREFETCHSIZE 32 OVERHEAD 10.50 TRANSFERRATE 0.14 USER TABLESPACE MANAGED BY SYSTEM USING ( 'D:\dbconter\ $N_1' ) EXTENTSIZE 32 PREFETCHSIZE 32 TEMPORARY TABLESPACE MANAGED BY SYSTEM USING ( 'D:\dbsystmpconter\cont $N_1' ) EXTENTSIZE 32 PREFETCHSIZE 32 WITH 'mydbcreate';
七:创建分区组
CONNECT TO MYDB;
CREATE DATABASE PARTITION GROUP "MYGROUP" ON DBPARTITIONNUMS (0,1);
COMMENT ON DATABASE PARTITION GROUP "MYGROUP" IS '';
CONNECT RESET;
八:创建缓冲池
CONNECT TO MYDB;
CREATE BUFFERPOOL MYBP IMMEDIATE DATABASE PARTITION GROUP "MYGROUP" SIZE 250 PAGESIZE 4 K EXTENDED STORAGE ;
CONNECT RESET;
九:创建表数据空间
CONNECT TO MYDB;
CREATE REGULAR TABLESPACE MYTABLESPACE IN DATABASE PARTITION GROUP "MYGROUP" PAGESIZE 4 K MANAGED BY SYSTEM USING ('D:\mydbcont\cont0' ) ON DBPARTITIONNUM (0) USING ('D:\mydbcont\cont1' ) ON DBPARTITIONNUM (1) EXTENTSIZE 32 OVERHEAD 10.5 PREFETCHSIZE 32 TRANSFERRATE 0.14 BUFFERPOOL MYBP DROPPED TABLE RECOVERY OFF;
COMMENT ON TABLESPACE MYTABLESPACE IS 'mytablespace';
CONNECT RESET;
十:创建用户临时表空间
CONNECT TO MYDB;
CREATE USER TEMPORARY TABLESPACE MYTABSPTMP IN DATABASE PARTITION GROUP "MYGROUP" PAGESIZE 4 K MANAGED BY SYSTEM USING ('D:\mytmpsp\cont0' ) ON DBPARTITIONNUM (0) USING ('D:\mytmpsp\cont1' ) ON DBPARTITIONNUM (1) EXTENTSIZE 32 OVERHEAD 10.5 PREFETCHSIZE 32 TRANSFERRATE 0.14 BUFFERPOOL MYBP ;
COMMENT ON TABLESPACE MYTABSPTMP IS 'mytabsptmp';
CONNECT RESET;