Today, we will share with you the actual operation process for establishing database Partition in DB2. The following describes the actual operation process for establishing database Partition in DB2, I hope this will help you in your future studies.
In the actual operation process, we need to create a db instance for the relevant database partition. You can use the command to create a db instance: DB2icrt-s ESE-u db2admin, aaa123456-h ANWENHAO DBINSTANCENAME
Create database partition in DB2
1. Create a db instance for which you need to create a database partition
You can run the following command to create a db instance:
- DB2icrt -s ESE -u db2admin,aaa123456 -h ANWENHAO DBINSTANCENAME
After creating the corresponding instance, You need to restart DB2.
2. Add the new db instance to DB2:
- CATALOG LOCAL NODE DB2INST1 INSTANCE DB2INST1 SYSTEM ANWENHAO OSTYPE NT;
3. Set the dbInstance to be operated in the command line
- set db2instance=db2inst1
- db2 get instance
- db2 attach to db2inst1
4. Create DBPartition:
- db2start dbpartitionnum 1 ADD DBPARTITIONNUM HOSTNAME ANWENHAO PORT 1
- COMPUTER ANWENHAO USER db2admin PASSWORD aaa123456 WITHOUT TABLESPACES
5. After creation, you need to restart db2. At this time, DB2 will add a DB2 database partition and redistribution.
The preceding operation completes database partition.
Create database partition group:
- CREATE DATABASE PARTITION GROUP "NODE1" ON DBPARTITIONNUMS (1);
- COMMENT ON DATABASE PARTITION GROUP "NODE1" IS 'ANWENHAO _1';
Then, you can choose whether to create a table space in a DB2 database partition group. In this way, we can easily use DB2 database Partition to create cluster applications.