Nonstop Database, HiRDB Version 9 System Operation Guide

[Contents][Index][Back][Next]

13.11.3 Example: Increasing the number of row partitions in a rebalancing table

This example increases the number of row partitions in rebalancing table TABLE01 from 2 to 3. Its index (INDX01) is partitioned likewise.

Note
In order to execute the rebalancing utility, the number of RDAREAs storing indexes must match the number of RDAREAs storing tables.
[Figure]
Organization of this subsection
(1) Use the pdfmkfs command to create a HiRDB file system area for RDAREAs
(2) Use the pdmod command to add RDAREAs
(3) Use the ALTER TABLE statement to increase the number of table row partitions
(4) Use the pdrbal command to rebalance the table
(5) Use the pdgetcst command to collect optimization information for the table

(1) Use the pdfmkfs command to create a HiRDB file system area for RDAREAs

 
pdfmkfs -n 50 -l 10 -k DB -i /rdarea/area03
pdfmkfs -n 50 -l 10 -k DB -i /rdarea/area13
 

Explanation
-n: Specifies in megabytes the size of the HiRDB file system area. Use the database condition analysis utility (pddbst command) to analyze the status of the existing RDAREAs, and, taking existing RDAREAs into account, estimate the size of the RDAREAs to be added from the volume of data to be migrated.
-l: Specifies the maximum number of HiRDB files to be created in the HiRDB file system area.
-k: Specifies the purpose of the HiRDB file system area. Specify DB to create a HiRDB file system area for RDAREAs.
-i: Specifies that the entire HiRDB file system area is to be initialized. When the -i option is specified, the entire area is allocated. When the -i option is omitted, only management information for the HiRDB file system area is created.
/rdarea/area03: Specifies a name for the HiRDB file system area that is to be created for RDAREAs to be used to store tables.
/rdarea/area13: Specifies the name of the HiRDB file system area that is to be created for RDAREAs to be used to store indexes.

(2) Use the pdmod command to add RDAREAs

 
pdmod -a /pdmod/create01
 

Explanation
-a: Specifies the name of the control statements file for the pdmod command. Below is an example of a control statements file. For details on the operands, see the manual HiRDB Version 9 Command Reference.
 
create rdarea RDAREA03
   globalbuffer gbuf03
   for user used by PUBLIC
   server name bes1
   page 4096 characters
   storage control segment 10 pages
   file name "/rdarea/area03/file01"
      initial 1000 segments;
create rdarea RDAREA13
   globalbuffer gbuf13
   for user used by PUBLIC
   server name bes1
   page 4096 characters
   storage control segment 10 pages
   file name "/rdarea/area13/file01"
      initial 1000 segments;
 

(3) Use the ALTER TABLE statement to increase the number of table row partitions

 
ALTER TABLE TABLE01
    ADD RDAREA RDAREA03
      FOR INDEX INDX01 IN RDAREA13;
 

An RDAREA for storing table data (RDAREA03) and an RDAREA for storing indexes (RDAREA13) have been added. The number of row partitions in TABLE01 has now been increased from 2 to 3.

(4) Use the pdrbal command to rebalance the table

(a) Execution in shared mode
 
pdrbal -k share -t TABLE01 -c 100 /pdrbal/cfile01
 

Explanation
-k: Specifies share for execution in the shared mode.
-t: Specifies the name of the rebalancing table.
-c: Specifies the unit of commitment.
/pdrbal/cfile01: Specifies the name of the control statements file for the pdrbal command. The following are the contents of the control statements file:
 
report /tmp/output
execstop time,9:00
 

Explanation
report: Specifies the output destination for the execution results of the pdrbal command.
execstop: Specifies the execution time for the pdrbal command.
(b) Execution in exclusive mode
 
pdrbal -k exclusive -t TABLE01 -l a /pdrbal/cfile01
 

Explanation
-k: Specifies exclusive for execution in the exclusive mode.
-t: Specifies the name of the rebalancing table.
-l: Specifies the method for collecting the database updates log. In this example, the log acquisition mode is specified.
/pdrbal/cfile01: Specifies the name of the control statements file for the pdrbal command. The following are the contents of the control statements file:
 
report /tmp/output
idxwork /index/work
sort /sort/work
 

Explanation
report: Specifies the output destination for the execution results of the pdrbal command.
idxwork: Specifies the name of the directory for output of the index information file.
sort: Specifies the name of the work directory for sorting.

(5) Use the pdgetcst command to collect optimization information for the table

If necessary, use the optimizing information collection utility (pdgetcst command) to collect optimization information for the table. For details about whether execution of the optimizing information collection utility is required, see the manual HiRDB Version 9 Command Reference.

 
pdgetcst -t TABLE01 -l /pdgetcst/output
 

Explanation
-t: Specifies the name of the table for which optimization information is to be collected.
-l: Specifies the output destination for the execution results of the pdgetcst command.

We recommend that after the command has executed you check whether the execution results are correct. For details on how to check command execution results, see the manual HiRDB Version 9 Command Reference.