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

Altering database partition groups—adding partitions to database partition groups

At this point, we have finished adding the new partitions 3 and 4 to our database; in the following recipe, we will include them in our NAVDATAGRP database partition group.

Getting ready

In this recipe, we will demonstrate how to add the two newly created partitions, in the Adding database partitions recipe, into the NAVDATAGRP database using Control Center and the command line.

How to do it...

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

Using Control Center

  1. In Control Center, navigate to the NAV database, go to Database partition groups, and right-click on NAVDATAGRP; choose Alter…. Next, check Assign available database partition groups to this partition group.
    Using Control Center
  2. On the next screen, under Available nodes, check partitions 3 and 4:
    Using Control Center
  3. On the next screen, you get a dialog that asks to copy container settings from existent partitions by clicking the button:
    Using Control Center
  4. In the next step, choose the containers used as models for our new containers being created:
    Using Control Center
  5. You must rename the files, suffix them with p3 and p4, according to the partition number on which they are to be defined:
    Using Control Center
  6. Click on Change… button and rename the files, adding p3 as suffix for partition 3; proceed similarly for partition 4:
    Using Control Center
  7. Navigate through the remaining step and click Finish.

Using the command line

  1. To add partitions 3 and 4 to the database partition group NAVDATAGRP, issue the following command:
    [db2instp@nodedb21 ~]$ db2 "ALTER DATABASE PARTITION GROUP "NAVDATAGRP" ADD DBPARTITIONNUM (3,4) WITHOUT TABLESPACES" 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. To add a container to the NAV_TBLS table space on partition 3, issue the following command:
    [db2instp@nodedb21 ~]$ db2 "ALTER TABLESPACE NAV_TBLS ADD (FILE '/data/db2/db2instp/nav_tbls0p3.dbf' 20 M) ON DBPARTITIONNUM (3)" 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 ~]$ 
  3. To add a container to the NAV_TBLS table space on partition 4, issue the following command:
    [db2instp@nodedb21 ~]$ db2 "ALTER TABLESPACE NAV_TBLS ADD (FILE '/data/db2/db2instp/nav_tbls0p4.dbf' 20 M) ON DBPARTITIONNUM (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 ~]$ 
  4. To add a container to the NAV_INDX table space on partition 3, issue the following command:
    [db2instp@nodedb21 ~]$ db2 "ALTER TABLESPACE NAV_INDX ADD (FILE '/data/db2/db2instp/nav_indx0p3.dbf' 20 M) ON DBPARTITIONNUM (3)" 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 ~]$ 
  5. To add a container to the NAV_INDX table space on partition 4, issue the following command:
[db2instp@nodedb21 ~]$ db2 "ALTER TABLESPACE NAV_INDX ADD (FILE '/data/db2/db2instp/nav_indx0p4.dbf' 20 M) ON DBPARTITIONNUM (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 ~]$ 

How it works…

We previously used to add partitions 3 and 4 the WITHOUT TABLESPACES option. This option is similar with the WITHOUT TABLESPACES used before in ADD DBPARTITIONNUM command and instructs the ALTER command that container creation is defered for the database partition being added; and you should add them manually later. This command similarly does not have any effect in case we are using table spaces with automatic storage allocation.

There's more…

Similarly we have the LIKE DBPARTITIONNUM <partition number> option of ADD DBPARTITIONNUM command. It may be used if we want to use as models the containers found on<partition number> for containers being added.

For example the command:

ALTER DATABASE PARTITION GROUP "NAVDATAGRP" ADD DBPARTITIONNUM (3) LIKE DBPARTITIONNUM (0) 

Containers placed on partition 0 will be used as models for containers being added on partition 3.

See also

The Creating and configuring table spaces in a multipartitioned environment recipe in Chapter 4, Storage—Using DB2 Table Spaces.

主站蜘蛛池模板: 甘南县| 乌海市| 乳山市| 西昌市| 雷山县| 夏津县| 西华县| 十堰市| 图木舒克市| 房产| 得荣县| 大新县| 海安县| 简阳市| 南开区| 澄迈县| 彰化市| 汉川市| 玉田县| 崇阳县| 高密市| 武定县| 方正县| 民县| 武隆县| 噶尔县| 辽宁省| 汉川市| 苍山县| 博爱县| 靖西县| 宁强县| 张家口市| 上高县| 明溪县| 溧水县| 丽水市| 包头市| 襄垣县| 龙川县| 松潘县|