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

Altering database partition groups— removing partitions from a database partition group

Usually, removing partitions from a database partition group is a seldom operation. It may be performed, for example, when a server containing the partitions is removed and commissioned from the configuration, or a partition is not placed optimally and induces performance problems. This is the first step if we want to drop the database partitions from the database.

Getting ready

In this recipe, we will remove partitions 3 and 4, added before to the NAVDATAGRP database partition group, and redistribute data on the remaining partitions.

How to do it...

It is highly recommended, before you begin, to drop a partition from a database partition group to perform a full database backup.

Using the command line

  1. To remove partitions 3 and 4, execute the following command:
    [db2instp@nodedb21 ~]$ db2 "ALTER DATABASE PARTITION GROUP NAVDATAGRP DROP DBPARTITIONNUMS (3 TO 4)" SQL1759W Redistribute database partition group is required to change database partitioning for objects in database partition group "NAVDATAGRP" to include some added database partitions or exclude some dropped database partitions. SQLSTATE=01618 [db2instp@nodedb21 ~]$ 
  2. Initially, the partitions are just marked as removed; actually, we have to redistribute data from them as the warning message SQL179W instructs us. After the redistribution operation is finished, they are removed completely. To see the status of partition 3 and 4, run the following statement:
    [db2instp@nodedb21 ~]$db2" select * from sysibm.sysnodegroupdef where ngname='NAVDATAGRP'" NGNAME NODENUM IN_USE NAVDATAGRP 0 Y NAVDATAGRP 1 Y NAVDATAGRP 2 Y NAVDATAGRP 3 T NAVDATAGRP 4 T [db2instp@nodedb21 ~]$ T -means that the distribution map is removed and no longer availaible 
  3. Now, redistribute data to the remaining partitions 0, 1, and 2:
    [db2instp@nodedb21 ~]$ db2 "REDISTRIBUTE DATABASE PARTITION GROUP NAVDATAGRP UNIFORM" DB20000I The REDISTRIBUTE NODEGROUP command completed successfully. 
  4. Now, we can see that the partitions 3 and 4 are completely removed and do not appear in catalog:
[db2instp@nodedb21 ~]$ db2 "select * from sysibm.sysnodegroupdef where ngname='NAVDATAGRP'" NGNAME NODENUM IN_USE NAVDATAGRP 0 Y NAVDATAGRP 1 Y NAVDATAGRP 2 Y [db2instp@nodedb21 ~]$ 

Note

You can also use the LIST DATABASE PARTITION GROUPS SHOW DETAIL command to list detailed information about partition groups .

How it works...

Removing partitions from a database partition group is an operation similar to adding partitions in terms of internal processing.

There's more...

At this step do not remove database partitions that contain data by editing manually the db2nodes.cfg database partition configuration file.

主站蜘蛛池模板: 绥阳县| 贞丰县| 道真| 韶山市| 于都县| 肥东县| 新民市| 澎湖县| 铜鼓县| 年辖:市辖区| 红桥区| 桐柏县| 澜沧| 汶上县| 阿合奇县| 南靖县| 班戈县| 安泽县| 九江县| 伊宁市| 文水县| 腾冲县| 文安县| 奉化市| 四子王旗| 福州市| 溧水县| 盈江县| 喀什市| 洛川县| 新晃| 青浦区| 监利县| 合山市| 中西区| 丰镇市| 晋宁县| 惠来县| 麻城市| 门源| 娱乐|