Nonstop Database, HiRDB Version 9 System Operation Guide

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

13.16.1 Example 1: Migrating data to another table

This example moves (copies) the data from TABLE1 to TABLE2. The table definitions of TABLE1 and TABLE2 differ as follows:

[Figure]

Organization of this subsection
(1) Use the pdhold command to shut down the RDAREAs subject to data unloading and loading
(2) Create the control statements file for the pdrorg command
(3) Use the pdrorg command to unload data from TABLE01
(4) Create the column structure information file (/pdload/column01)
(5) Create the control statements file for the pdload command
(6) Use the pdload command to load data into TABLE02
(7) Back up the RDAREAs in which data was loaded
(8) Use the pdrels command to release RDAREAs from shutdown status

(1) Use the pdhold command to shut down the RDAREAs subject to data unloading and loading

 
pdhold -r RDAREA01,RDAREA02,...
 

(2) Create the control statements file for the pdrorg command

The contents of the control statements file (/pdrorg/rorg01) are shown below.

(a) HiRDB single server configuration
 
unload /pdrorg/unfile1                                1
unld_func type=sgmltext,func=unsgmltext(sgmltext)     2
 

Explanation
  1. Specifies the name of the unload data file.
  2. Specifies information on the constructor parameter reverse generation function, because the SGMLTEXT type is defined for the table.
(b) HiRDB parallel server configuration
 
unload bes1:/pdrorg/unfile1                          1
unld_func type=sgmltext,func=unsgmltext(sgmltext)    2
 

Explanation
  1. Specifies the name of the unload data file.
  2. Specifies information on the constructor parameter reverse generation function, because the SGMLTEXT type is defined for the table.

(3) Use the pdrorg command to unload data from TABLE01

 
pdrorg -k unld -W bin -t TABLE01 -g /pdrorg/rorg01
 

Explanation
-k: Specifies unld for unloading.
-W bin: Specifies that the unload data file is to be used as the input file (binary format) for the pdload command.
-t: Specifies the name of the table that is to be unloaded.
-g: Specifies that TABLE01 is row-partitioned between servers in a HiRDB parallel server configuration. Specifying the -g option consolidates the unload data files (into a single file).
/pdrorg/rorg01: Specifies the name of the control statements file for the pdrorg command.

(4) Create the column structure information file (/pdload/column01)

 
*skipdata*,type=integer
C5
C6,func=(sgmltext,param=blob)
C7
 

Because the column structure of the input data file created in step (3) differs from the column structure of TABLE02, a column structure information file is needed for data loading. For an example of specifying a column structure information file, see 13.16.3 Specification examples of column structure information files.

(5) Create the control statements file for the pdload command

The contents of the control statements file (/pdload/load01) are shown below.

(a) HiRDB single server configuration
 
source /pdrorg/unfile1
 

Explanation
Specifies the name of the unload data file created in step (3).
(b) HiRDB parallel server configuration
 
source bes1:/pdrorg/unfile1
 

Explanation
Specifies the name of the unload data file created in step (3).

(6) Use the pdload command to load data into TABLE02

 
pdload -b -W -c /pdload/column01 TABLE02 /pdload/load01
 

Explanation
-b: Specifies that binary data is to be loaded.
-W: Specifies that an input data file in binary format, created with the pdrorg command, is to be used.
-c /pdload/column01: Specifies the name of the column structure information file created in step (4).
TABLE02: Specifies the name of the table into which the data is to be loaded.
/pdload/load01: Specifies the name of the control statements file for the pdload command.

(7) Back up the RDAREAs in which data was loaded

Because you loaded data in the pre-update acquisition mode (default), back up the RDAREAs in which data was loaded. For details about backing up RDAREAs, see 6.4.8 Example 8 (backing up specified RDAREAs).

(8) Use the pdrels command to release RDAREAs from shutdown status

 
pdrels -r RDAREA01,RDAREA02,...
 

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.