DB2 New Database

Source: Internet
Author: User

I. Building table spaces and databases

1. Implemented on DB2AD, db2db and Db2ap:

[SQL] view plaincopyprint?

    1. Db2set Db2comm=tcpip
    2. Db2set db2codepage=1386

Db2set Db2comm=tcpip

Db2set db2codepage=1386

2. Create a new database:

[SQL] view plaincopyprint?

    1. DB2 Create DB <dbname> using CodeSet GBK territory CN collate using identity

DB2 Create DB <dbname> using CodeSet GBK territory CN collate using identity

3. Connect to the database:

[SQL] view plaincopyprint?

    1. DB2 "Connect to <dbname>"

DB2 "Connect to <dbname>"

4. Create buffer pool + set up table space;
1). Delete the old table space:

[SQL] view plaincopyprint?

    1. DB2 Drop Tablespace Tablespace1, Tablespace2, Tablespace3

DB2 Droptablespace Tablespace1, Tablespace2,tablespace3

2). Create a new buffer pool:

[SQL] view plaincopyprint?

    1. DB2 Create Bufferpool bp32k all nodes size-1 pagesize 32k

DB2 Createbufferpool bp32k all nodes size-1 pagesize 32k

Bp32k is the name of the buffer pool;
32K is the page size;
Size=-1 indicates that the default buffpage is used, and buffpage can be found by DB2 get DB cfg|grep-i buff parameters;
3). Create a new table space:

[SQL] view plaincopyprint?

    1. DB2 "Create regular tablespace Tablespace1 pagesize 32k managed by database using (file '/usr/yixiayizi/tablespace1 ' 5g) b Ufferpool bp32k "
    2. DB2 "Create regular tablespace Tablespace2 pagesize 32k managed by database using (file '/usr/yixiayizi/tablespace2 ' 10g) Bufferpool bp32k "
    3. DB2 "Create regular tablespace tablespace3 pagesize 32k managed by database using (file '/usr/yixiayizi/tablespace3 ' 2g) b Ufferpool bp32k "

DB2 "Createregular tablespace Tablespace1 pagesize32k managed by database using (file '/usr/yixiayizi/tablespace1 ' 5g) buf ferpoolbp32k "

DB2 "Createregular tablespace tablespace2 pagesize32k managed by database using (file '/usr/yixiayizi/tablespace2 ' 10g) bu fferpoolbp32k "

DB2 "Createregular tablespace tablespace3 pagesize32k managed by database using (file '/usr/yixiayizi/tablespace3 ' 2g) buf ferpoolbp32k "

Note the setting (file '/usr/yixiayizi/tablespace1 ' 5g):
First parameter:
When pointing to an external disk, file is changed to device;
When pointing to the file path, it is files;
Second parameter: The absolute path is required;
The third parameter: the size of the table space;

DB2 New Database

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.