官术网_书友最值得收藏!

Adding database partitions

One of the notable advantages of database partitioning is scalability. Let us suppose that we want to supplement the processing power by providing more CPUs and memory, or we intend to add a new server in the infrastructure to increase processing power. In any of these cases, we should add one or more partitions to our existent database proportionally with the supplementary processing power, in order to benefit from the scalability of the multipartitioned environment. It is recommended to allocate a minimum of one CPU per database partition.

Getting ready

In the following recipe, we will add two new partitions, one on nodedb21 and one on nodedb22.

How to do it...

You can perform these operations with Control Center or using the command line.

Using Control Center

  1. In Control Center, right-click to navigate to the db2instp instance, and then right-click and choose Add Database Partitions….
    Using Control Center
  2. In the Add Database Partitions Wizard screen, click on the Next button, and next click the Add button to add partition 3 on nodedb21, with logical port 2, and partition 4 on nodedb22 with logical port 1:
    Using Control Center
  3. Follow the wizard through steps 3 and 4 and click Finish.

Using the command line

  1. To add partition 3 on host nodedb21 with logical port 2, issue the following command:
    [db2instp@nodedb21 ~]$ db2start dbpartitionnum 3 ADD DBPARTITIONNUM HOSTNAME nodedb21 PORT 2 WITHOUT TABLESPACES 06/27/2011 18:14:38 3 0 SQL1489I The add database partition server operation was successful. The new database partition server "3" is active. [db2instp@nodedb21 ~]$ 
  2. To add partition 4 on host nodedb22, with logical port 1, issue the following command:
[db2instp@nodedb21 ~]$ db2start dbpartitionnum 4 ADD DBPARTITIONNUM HOSTNAME nodedb22 PORT 1 WITHOUT TABLESPACES 06/27/2011 18:15:18 4 0 SQL1489I The add database partition server operation was successful. The new database partition server "4" is active. [db2instp@nodedb21 ~]$ 

Note

All these operations will modify the db2nodes.cfg database partition configuration file. From version 9.7 database partitions can be added in online mode and are immediately visible to the instance. This behavior is controlled by DB2_FORCE_OFFLINE_ADD_PARTITION registry variable which in version 9.7 is by default set to FALSE. If it has a value of TRUE the instance might be restarted after adding partitions.

How it works...

After every new partition is added, a corresponding new entry is created in db2nodes.cfg.For example, after adding the two new partitions, db2nodes.cfg contains the following entries:

[db2instp@nodedb21 sqllib]$ more db2nodes.cfg 0 nodedb21 0 1 nodedb22 0 2 nodedb21 1 3 nodedb21 2 4 nodedb22 1 

To add partition 3 and 4 we used the WITHOUT TABLESPACES option of ADD DBPARTITIONNUM command. Using this option no container is created for system temporary tables paces on partitions being added If this option is omitted the system temporary table space containers from the lowest numbered partition are used as models. However, there is an exemption from this rule in the case we use automatic managed storage, namely the containers for these type of table spaces are created regardless this option is used or not.

There's more…

In Linux and Unix the same operations can be made by editing the db2nodes.cfg database partition configuration file. For example, if we add one more partition entry, 5 nodedb22 2, in db2nodes.cfg, this operation is identical to issuing the db2start dbpartitionnum 5 ADD DBPARTITIONNUM HOSTNAME nodedb22 PORT 2 WITHOUT TABLESPACES command.

There is another option that can be used with ADD DBPARTITIONNUM commandLIKE DBPARTITIONNUM <partition number>. It should be used if we want to add system temporary table space containers, using as models those from<partition number>, to the new partition being created. For example:

db2start dbpartitionnum 3 ADD DBPARTITIONNUM HOSTNAME nodedb21 PORT 2 LIKE DBPARTITIONUM (1)

System temporary table space containers from partition 1 will be used as models for tables space containers created on partition 3.

主站蜘蛛池模板: 乐安县| 丽水市| 通江县| 浮梁县| 晋中市| 额济纳旗| 黔南| 宜章县| 通辽市| 建宁县| 海丰县| 博爱县| 保靖县| 柯坪县| 龙岩市| 略阳县| 遂溪县| 万载县| 金塔县| 巫溪县| 鄂伦春自治旗| 南溪县| 增城市| 南乐县| 通许县| 满洲里市| 拜城县| 托里县| 清镇市| 昌邑市| 洪江市| 武清区| 剑川县| 泰州市| 隆安县| 炎陵县| 承德县| 庆城县| 南昌市| 天祝| 迭部县|