10.2 Examples

This section presents examples (1 to 5) of using the rebalancing utility.

Organization of this section
(1) Shared mode
(2) Exclusive mode

(1) Shared mode

Example 1
This example adds an RDAREA (user03) to a table (reb_table) in a HiRDB single server configuration and executes the rebalancing utility in the shared mode.
  • Table definition:

CREATE TABLE reb_table(hkeys INT NOT NULL,names CHAR(30))
   FIX HASH HASHA BY hkeys IN (user01,user02)

  • Index definition:

CREATE INDEX idx1 ON reb_table(hkeys) IN ((idx01),(idx02))

Explanation:
This statement adds RDAREA user03 to table reb_table. It also adds RDAREA idx03 to index idx1.
Explanation:
-k share: Operation mode (shared mode)
-t reb_table: Name of the rebalancing table
control_file: Control information file
Explanation:
  1. Terminates pdrbal nine hours later.
  2. Outputs the execution result of pdrbal to the process results file (/dsk01/rest_file).
Example 2
This example adds an RDAREA (user03) to a table (sgml_table) in a HiRDB single server configuration and executes the rebalancing utility in the shared mode. The sgml_table table contains the columns of abstract data type provided by a plug-in.
  • Table definition:

CREATE TABLE sgml_table (
   hkeys INT NOT NULL,
   doctext SGMLTEXT ALLOCATE (sgmltext IN ((LOB1D),
                             (LOB2D)))
   PLUGIN '<DTD>NEWSPAPER</DTD><EXTRACTparm>extract.prm
                    </EXTRACTparm>'
   )
   FIX HASH HASHA BY hkeys IN (user01,user02)

  • Index definition:

CREATE INDEX idx1 ON sgml_table(hkeys) IN ((idx01),(idx02))
CREATE INDEX ngram_index USING TYPE MASTER.NGRAM on sgml_table(doctext)
   in ((LOB1I),(LOB2I))

Explanation:
This statement adds RDAREA user03 to table sgml_table. It also adds RDAREA idx03 to index idx1 and RDAREA LOB3I to plug-in index ngram_index.
Explanation:
-k share: Operation mode (shared mode)
-t sgml_table: Name of the rebalancing table
control_file: Control information file
Explanation:
  1. Terminates pdrbal 12 hours later.
  2. Specifies a constructor parameter reverse creation function.
    sgmltext: Name of the abstract data type
    unsgmltext: Name of the constructor parameter reverse creation function
    sgmltext: Type of argument
  3. Specifies a constructor function.
    sgmltext: Name of the abstract data type
    sgmltext: Name of the constructor function
    blob: Type of argument
  4. Outputs the execution result of pdrbal to the process results file (/dsk01/rest_file).

(2) Exclusive mode

Example 3
This example adds an RDAREA (user03) to a table (reb_table) in a HiRDB single server configuration and executes the rebalancing utility in the exclusive mode.
  • Table definition:

CREATE TABLE reb_table(hkeys INT NOT NULL,names CHAR(30))
   FIX HASH HASHA BY hkeys IN (user01,user02)

  • Index definition:

CREATE INDEX idx1 ON reb_table(hkeys) IN ((idx01),(idx02))

Explanation
This statement adds RDAREA user03 to table reb_table. It also adds RDAREA idx03 to index idx1.
Explanation
-k exclusive: Operation mode (exclusive mode)
-t reb_table: Name of the rebalancing table
-l n: no-log mode
control_file: Control information file
Explanation
  1. Specifies a directory for index information files (/idxwork1).
  2. Specifies a work directory for sorting (/sortwork).
  3. Outputs the execution result of pdrbal to the process results file (/dsk01/rest_file).
Example 4
This example adds an RDAREA (user03) to a table (reb_table) in a HiRDB parallel server configuration and executes the rebalancing utility in the exclusive mode.
  • Table definition:

CREATE TABLE reb_table(hkeys INT NOT NULL,names CHAR(30))
   FIX HASH HASHA BY hkeys IN (user01,user02)

  • Index definition:

CREATE INDEX idx1 ON reb_table(hkeys) IN ((idx01),(idx02))

Explanation:
This statement adds RDAREA user03 to table reb_table. It also adds RDAREA idx03 to index idx1.
Explanation:
-k exclusive: Operation mode (exclusive mode)
-t reb_table: Name of the rebalancing table
-l n: no-log mode
control_file: Control information file
Contents of the control information file (control_file)

idxwork bes2 /idxwork_bes2    1
sort bes2 /sortwork_bes2      2
report /dsk01/rest_file       3

Explanation:
  1. Specifies a directory for index information files (/idxwork_bes2) at the bes2 back-end server.
  2. Specifies a work directory for sorting (/sortwork_bes2) at the bes2 back-end server.
  3. Outputs the execution result of pdrbal to the process results file (/dsk01/rest_file).
Example 5
This example adds the same RDAREAs as the existing one for a table (reb_table) in a HiRDB parallel server configuration and executes the rebalancing utility in the exclusive mode. The table is partitioned and stored in back-end server bes1 on host NODE24 and back-end server bes2 on host NODE25.
  • Table definition:

 CREATE TABLE reb_table (hkeys INT NOT NULL,names CHAR(30))
     FIX HASH HASHF BY hkeys IN (user01,user02)

  • Index definition:

 CREATE INDEX idx1 ON reb_table(hkeys) IN ((idx01),(idx02))

Explanation:
This statement adds the same RDAREAs (user01 and user02) as the existing one to table reb_table. It also adds the same RDAREAs (idx01 and idx02) as the existing one to index idx1.
Explanation:
-k exclusive: Operation mode (exclusive mode)
-t reb_table: Name of the rebalancing table
-i c: Index creation mode (batch creation mode)
control_file: Control information file
Explanation:
  1. Outputs the execution result of pdrbal to the process results file (/dsk01/rest_file).
  2. Specifies information about back-end server bes1 for an added RDAREA (idx01).
    Name of directory for index information file: /idxwork_bes1
    Name of work directory for sorting: /sort_work_bes1
  3. Specifies information about back-end server bes2 for an added RDAREA (idx02).
    Name of directory for index information file: /idxwork_bes2
    Name of work directory for sorting: /sortwork_bes2