Nonstop Database, HiRDB Version 9 System Operation Guide
(1) Use the pdhold command to shut down RDAREAs in which TABLE01 is stored
pdhold -r RDAREA1,RDAREA2,...
|
(2) Use the pdrorg command to unload data from TABLE01
pdrorg -k unld -W bin -t TABLE01 -g /pdrorg/unld01
|
- 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. Because TABLE01 contains character data (0x00 and 0x0a) that cannot be converted to DAT format, the data is converted to binary format and unloaded.
- -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/unld01: Specifies the name of the control statements file for the pdrorg command.
(3) Use the pdrels command to release RDAREAs from shutdown status
pdrels -r RDAREA1,RDAREA2,...
|
(4) Use the PURGE TABLE statement to delete data from TABLE01
(5) Use the ALTER TABLE statement to add column C4
ALTER TABLE TABLE01 ADD C4 INTEGER WITH DEFAULT;
|
The WITH DEFAULT operand must be specified in this step. In this case, 0 is stored in column C4.
(6) Create the column structure information file (/pdload/column01)
C1,type=char(4)
C2,type=char(10)
C3,type=integer
|
A column structure information file in which the data types of TABLE01 are specified is created.
Although a binary format file was created in step (2), it is treated as a fixed-size data format file because the table has the FIX attribute. Therefore, a column structure information file necessary for unloading data from a fixed-size data format file is created. This way, data can be loaded into TABLE01, which has a column structure that is different from the column structure of the input data file.
- Note on specifying a column structure information file
- When a column structure information file is specified after a column has been added, it is important not to specify the added column. That way, HiRDB will detect that the input data does not contain any data for that column and will store the default value or the NULL value in the added column. Because the NULL value cannot be stored in a table with the FIX attribute, the default value must be set in such a case by specifying the WITH DEFAULT operand when the column is added with an ALTER TABLE statement.
(7) Use the pdhold command to shut down RDAREAs in which TABLE01 is stored
pdhold -r RDAREA1,RDAREA2,...
|
(8) Load data into TABLE01
pdload -a -c /pdload/column01 TABLE01 /pdload/load01
|
- Explanation
- -a: Specifies that the input file is a fixed-size data format file.
- -c /pdload/column01: Specifies the name of the column structure information file created in step (6).
- TABLE01: 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.
(9) Back up the RDAREAs in which data was loaded
(10) Use the pdrels command to release RDAREAs from shutdown status
pdrels -r RDAREA1,RDAREA2,...
|
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.
All Rights Reserved. Copyright (C) 2011, 2015, Hitachi, Ltd.