DB2 manual database creation

Source: Internet
Author: User
It is easy to create a database manually in DB2. Create an example Database: 1. Generate a database storage directory and an archive directory mkdir-pdemosamplemkdir-p

It is easy to create a database manually in DB2. Create an example Database: 1. Generate a database storage directory and an archive directory mkdir-p/demo/sample mkdir-p

It is easy to create a database manually in DB2.

Create an example database:
1. Generate database storage directories and archive Directories
Mkdir-p/demo/sample
Mkdir-p/demo/samplearc
2. Generate a sample database
Db2sampl-dbpath/demo/sample
3. Specify the database archive directory
-- DISK: Refers to disk tsm: Refers to ibm tsm vendor: Refers to a third-party storage device
Db2 update db cfg for SAMPLE using LOGARCHMETH1 DISK:/demo/samplearc


Create other databases:

1. Find the default database creation path
#./Db2 get dbm cfg | grep "DFTDBPATH"
Default database path (DFTDBPATH) =/home/db2inst1
Of course, you can also manually specify
// Create database mydb on d: \ data


2. Create a database
Simple Example:
Create database xcldb using codeset gbk territory cn;


Code Page and sorting order parameters:
All db2 character types (char varchar clob dbclob) have an associated character code page
That is, to convert the data into a binary database stored in the database.
The Chinese code page is 1386 codeset as GBK, and Territory is CN
Generate file:
Three default tablespaces, logs, configuration information, and historical files are created.
SYSCATSPACE Data Dictionary
TEMPSPACE1 temporary tablespace
USERSPACE1 stores all user objects (tables, indexes.
Before dbv9, the sms tablespace is used by default. After that, the dms tablespace is used by default except the temporary tablespace.


Complex examples:
Create database xcldb
DFT_EXTENT_SZ 4
CATALOG TABLESPACE MANAGED BY DATABASE USING
(FILE 'C: \ DATA \ CATALOG. DAT '2000, FILE 'd: \ DATA \ CATALOG. DAT '2000)
EXTENTSIZE 8
PREFETCHSIZE 16
TEMPORARY TABLESPACE MANAGED BY SYSTEM USING
('C: \ TEMPTS ', 'd: \ TEMPTS ')
USER TABLESPACE MANAGED BY DATABASE USING
(FILE 'C: \ XCLDB \ USERTS. data' 1200)
EXTENTSIZE 24
PREFETCHSIZE 48

-- DFT_EXTENT_SZ 4 the default size of the extended data block is four pages.
-- Catalog tablespace managed by database using the cataloguing space will be managed by the DATABASE
-- ('C: \ TEMPTS ', 'd: \ TEMPTS') Temporary tablespace will span two files.
-- (FILE 'C: \ TS \ USERTS. data' 1200) This space has only one container. It consists of 1200 pages.
-- EXTENTSIZE 24 The EXTENTSIZE of the user tablespace is 24 pages.
-- PREFETCHSIZE 48: Pre-read 48 pages


Recommended reading:

DB2 database performance adjustment and optimization (1st and 2) PDF

DB2 database performance optimization

,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.