DB2建库简单例⼦
--重启数据库
FORCE APPLICATION ALL
DB2STOP
DB2START
--创建数据库
CREATE DATABASE mysdedb USING CODESET UTF-8 TERRITORY US COLLATE USING SYSTEM USER TABLESPACE MANAGED BY DATABASE USING (FILE'd:\DB2\data\mysdedb\sdetbsp'51200) CONNECT TO mysdedb
--创建缓冲池(使⽤32k的pagesize)
create bufferpool sdepool size 12800 pagesize 32K
create bufferpool sdepool1 size 12800 pagesize 32K
--创建表空间并使⽤32k的pagesize和⾃定义的缓冲池
CREATE REGULAR TABLESPACE regtbs PAGESIZE 32 K MANAGED BY DATABASE USING ( FILE'C:\DB2\NODE0000\mysdedb\regtbs' 2g) bufferpool sdepool
CREATE REGULAR TABLESPACE idxtbs PAGESIZE 32 K MANAGED BY DATABASE USING ( FILE'C:\DB2\NODE0000\mysdedb\idxtbs' 1g) bufferpool sdepool
CREATE LONG TABLESPACE lobtbs PAGESIZE 32 K MANAGED BY DATABASE USING ( FILE'C:\DB2\NODE0000\mysdedb\lobtbs' 1g) bufferpool sdepool1
CREATE USER TEMPORARY TABLESPACE sdespace PAGESIZE 32 K MANAGED BY SYSTEM USING ('C:\DB2\NODE0000\mysdedb\sdespace' ) bufferpool sdepool1
--授权表空间给⽤户
grant use of tablespace
--授权表空间
GRANT USE OF TABLESPACE regtbs TO PUBLIC
GRANT USE OF TABLESPACE lobtbs TO PUBLIC
GRANT USE OF TABLESPACE idxtbs TO PUBLIC
GRANT USE OF TABLESPACE sdespace TO PUBLICdb2数据库安装
COMMENT ON TABLESPACE sdespace IS''
--优化数据库配置
update db cfg for mysdedb using APPLHEAPSZ 2048
update db cfg for mysdedb using APP_CTL_HEAP_SZ 2048
update db cfg for mysdedb using LOGPRIMARY 10
update db cfg for mysdedb using LOGFILSIZ 1000
--重启数据库
FORCE APPLICATION ALL
DB2STOP FORCE
DB2START
--授予sde⽤户DBADM权限
grant DBADM on database to user sde
--重启数据库
FORCE APPLICATION ALL
DB2STOP FORCE
DB2START
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论