10.2 Examples

This section presents examples (1-4) 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 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 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 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 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).