首页 > 数据库技术 > 详细

DB2建库简单例子

时间:2014-06-11 10:16:49      阅读:555      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
--重启数据库
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 PUBLIC 

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
bubuko.com,布布扣

 

DB2建库简单例子,布布扣,bubuko.com

DB2建库简单例子

原文:http://www.cnblogs.com/yangzhilong/p/3772875.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!