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

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.

主站蜘蛛池模板: 集贤县| 容城县| 桐梓县| 锦屏县| 定南县| 广汉市| 焉耆| 黄龙县| 安仁县| 南汇区| 普洱| 临邑县| 西安市| 临猗县| 汉源县| 库车县| 开江县| 阿城市| 武功县| 卓尼县| 孟村| 南汇区| 新巴尔虎右旗| 资阳市| 大同县| 河西区| 二连浩特市| 兴隆县| 商南县| 如皋市| 济南市| 社会| 农安县| 博客| 句容市| 丘北县| 上虞市| 什邡市| 饶阳县| 五台县| 开江县|