I. Building table spaces and databases
1. Implemented on DB2AD, db2db and Db2ap:
[SQL] view plaincopyprint?
- Db2set Db2comm=tcpip
- Db2set db2codepage=1386
Db2set Db2comm=tcpip
Db2set db2codepage=1386
2. Create a new database:
[SQL] view plaincopyprint?
- 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?
- 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?
- DB2 Drop Tablespace Tablespace1, Tablespace2, Tablespace3
DB2 Droptablespace Tablespace1, Tablespace2,tablespace3
2). Create a new buffer pool:
[SQL] view plaincopyprint?
- 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?
- DB2 "Create regular tablespace Tablespace1 pagesize 32k managed by database using (file '/usr/yixiayizi/tablespace1 ' 5g) b Ufferpool bp32k "
- DB2 "Create regular tablespace Tablespace2 pagesize 32k managed by database using (file '/usr/yixiayizi/tablespace2 ' 10g) Bufferpool bp32k "
- 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