- IBM DB2 9.7 Advanced Administration Cookbook
- Adrian Neagu Robert Pelletier
- 706字
- 2021-08-20 15:33:23
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.
- In Control Center, navigate to the
NAV
database, go to Database partition groups, and right-click onNAVDATAGRP
; choose Alter…. Next, check Assign available database partition groups to this partition group. - On the next screen, under Available nodes, check partitions 3 and 4:
- On the next screen, you get a dialog that asks to copy container settings from existent partitions by clicking the … button:
- In the next step, choose the containers used as models for our new containers being created:
- You must rename the files, suffix them with
p3
andp4
, according to the partition number on which they are to be defined: - Click on Change… button and rename the files, adding
p3
as suffix for partition3
; proceed similarly for partition4:
- Navigate through the remaining step and click Finish.
- To add partitions
3
and4
to the database partition groupNAVDATAGRP
, 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 ~]$
- To add a container to the
NAV_TBLS
table space on partition3
, 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 ~]$
- To add a container to the
NAV_TBLS
table space on partition4
, 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 ~]$
- To add a container to the
NAV_INDX
table space on partition3
, 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 ~]$
- To add a container to the
NAV_INDX
table space on partition4
, 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.
- Python科學計算(第2版)
- vSphere High Performance Cookbook
- 零基礎玩轉區塊鏈
- Mastering Entity Framework
- MATLAB應用與實驗教程
- Learning Neo4j 3.x(Second Edition)
- JavaScript 程序設計案例教程
- 碼上行動:用ChatGPT學會Python編程
- 零基礎學單片機C語言程序設計
- Java編程的邏輯
- C#開發案例精粹
- Scratch3.0趣味編程動手玩:比賽訓練營
- Getting Started with Polymer
- Learning Concurrency in Python
- 零基礎入門學習C語言:帶你學C帶你飛