- IBM DB2 9.7 Advanced Administration Cookbook
- Adrian Neagu Robert Pelletier
- 631字
- 2021-08-20 15:33:22
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.
- In Control Center, right-click to navigate to the db2instp instance, and then right-click and choose Add Database Partitions….
- 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:
- Follow the wizard through steps 3 and 4 and click Finish.
- 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 ~]$
- 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 command
—LIKE 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.
- Advanced Machine Learning with Python
- Mobile Web Performance Optimization
- Reporting with Visual Studio and Crystal Reports
- Learning Real-time Processing with Spark Streaming
- JavaScript:Functional Programming for JavaScript Developers
- C語言程序設計(第2版)
- EPLAN實戰設計
- Linux操作系統基礎案例教程
- Getting Started with NativeScript
- Go語言開發實戰(慕課版)
- C編程技巧:117個問題解決方案示例
- Java程序設計實用教程(第2版)
- Three.js權威指南:在網頁上創建3D圖形和動畫的方法與實踐(原書第4版)
- 數字媒體技術概論
- Python數據科學實踐指南