ITPub博客

首页 > 数据库 > 数据库开发技术 > db2手工建库

db2手工建库

原创 数据库开发技术 作者:dbSeeSee 时间:2016-06-13 16:54:16 0 删除 编辑

环境说明
CentOS6.5

  1. [db2inst3@kvm101 newtb]$ db2level
  2. DB21085I This instance or install (instance name, where applicable:
  3. "db2inst3") uses "64" bits and DB2 code release "SQL10014" with level
  4. identifier "0205010E".
  5. Informational tokens are "DB2 v10.1.0.4", "s140509", "IP23584", and Fix Pack
  6. "4".
  7. Product is installed at "/opt/ibm/db2/V10.1.0.5".

创建数据库


  1. mkdir -p /home/db2inst3/test

  2. db2 "create database testdb
  3. AUTOMATIC STORAGE NO
  4. on /home/db2inst3/test
  5. ALIAS test
  6. using codeset GBK
  7. territory zh_CN
  8. collate using identity
  9. PAGESIZE 8 k
  10. RESTRICTIVE
  11. catalog tablespace managed by system
  12.     using ('/home/db2inst3/test/catalog/')
  13. TEMPORARY tablespace managed by system
  14.     using ('/home/db2inst3/test/temp/')
  15. user tablespace managed by database
  16.     using (file '/home/db2inst3/test/user/usertab.file' 65000)"

test下表空间的目录和文件可以不用预创建


  1. [db2inst3@kvm101 test]$ du -sh *
  2. 93M catalog
  3. 14M db2inst3
  4. 8.0K temp
  5. 508M user


关于以上创建数据库的几点说明:

user表空间,pagezie是8k,65000个pagesize,总大小是8k*65000/1024=507.8125M

创建后的编目信息

数据库本身编目

 

Database 1 entry:

 

 Database alias                       = TESTDB

 Database name                        = TESTDB

 Local database directory             = /home/db2inst3/test

 Database release level               = f.00

 Comment                              =

 Directory entry type                 = Indirect

 Catalog database partition number    = 0

 Alternate server hostname            =

 Alternate server port number         =

 

别名编目

 

Database 3 entry:

 

 Database alias                       = TEST

 Database name                        = TESTDB

 Local database directory             = /home/db2inst3/test

 Database release level               = f.00

 Comment                              =

 Directory entry type                 = Indirect

 Catalog database partition number    = 0

 Alternate server hostname            =

 Alternate server port number         =


使用非自动存储管理,创建后的表空间情况


  1. TBSP_ID TBSP_NAME TBSP_TYPE TBSP_STATE AUTO_STORAGE AUTO_RESIZE
  2. ------- -------------------- ---------- ---------- ------------ -----------
  3.       0 SYSCATSPACE SMS NORMAL 0 -
  4.       1 TEMPSPACE1 SMS NORMAL 0 -
  5.       2 USERSPACE1 DMS NORMAL 0 0
  6.       3 SYSTOOLSPACE DMS NORMAL 0 1

  7.   4 record(s) selected.

关于pagesize 

PAGESIZE integer

 

Specifies the page size of the default buffer pool along with the initial table spaces (SYSCATSPACE, TEMPSPACE1, USERSPACE1) when the database is created. This also represents the default page size for all future CREATE BUFFERPOOL and CREATE TABLESPACE statements. The valid values for integer without the suffix K are 4 096, 8 192, 16 384, or 32 768. The valid values for integer with the suffix K are 4, 8, 16, or 32. At least one space is required between the integer and the suffix K. The default is a page size of 4 096 bytes (4 K).



关于RESTRICTIVE

 

If the RESTRICTIVE parameter is present it causes the restrict_access database configuration parameter to be set to YES and no privileges or authorities are automatically granted to PUBLIC. If the RESTRICTIVE parameter is not present then the restrict_access database configuration parameter is set to NO and privileges are automatically granted to PUBLIC. For information about privileges, see: "Default privileges granted on creating a database".



来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29023300/viewspace-2119612/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-07-04

  • 博文量
    28
  • 访问量
    124537