db2创建数据库

1.在实例用户用户下执行
db2 create database <DBName>  on /home/db2inst1/<DBName>  using codeset UTF-8 territory CN pagesize 32768
2.对用户进行赋权
db2 connect to <DBName>
db2 grant connect on database to user <user>
db2 grant dbadm on database to user <user>
3.创建schema
db2 create schema <schema> authorization <user>

4.创建缓存池
db2 CREATE BUFFERPOOL "<dbname>POOL" IMMEDIATE SIZE 100000 NUMBLOCKPAGES 0 PAGESIZE 32 K;

5.创建临时表空间
db2 CREATE USER TEMPORARY TABLESPACE "TMP<DBName>" PAGESIZE 32K MANAGED BY automatic storage EXTENTSIZE 32 PREFETCHSIZE AUTOMATIC BUFFERPOOL "<dbname>POOL" OVERHEAD 7.50 TRANSFERRATE 0.06 DROPPED TABLE RECOVERY OFF;

6.
db2 CREATE LARGE TABLESPACE "TSP_<dbname>" PAGESIZE 32K MANAGED BY automatic storage EXTENTSIZE 32 PREFETCHSIZE AUTOMATIC BUFFERPOOL "<dbname>POOL" OVERHEAD 7.50 TRANSFERRATE 0.06 DROPPED TABLE RECOVERY On;

7.
db2 CREATE LARGE TABLESPACE "TSP_LOG" PAGESIZE 32K MANAGED BY automatic storage EXTENTSIZE 32 PREFETCHSIZE AUTOMATIC BUFFERPOOL "<dbname>POOL" OVERHEAD 7.50 TRANSFERRATE 0.06 DROPPED TABLE RECOVERY ON;

8.
db2 CREATE LARGE TABLESPACE "TSP_INDEX" PAGESIZE 32K MANAGED BY automatic storage EXTENTSIZE 32 PREFETCHSIZE AUTOMATIC BUFFERPOOL "<dbname>POOL" OVERHEAD 7.50 TRANSFERRATE 0.06 DROPPED TABLE RECOVERY ON;

导数据
db2 set current schema <schema>;

上一篇:ASP.NET vNext or .NET vNext?


下一篇:关于linux下DB2创建数据库报错问题