Hitachi

Hitachi Advanced Database Command Reference


17.3.2 Importing table data in CSV format (when the column structure information file is specified)

This example imports table data under the following conditions:

[Figure]

This example uses the following procedure for executing the adbimport command.

Procedure
  1. Create an input data path file.

  2. Create an import option file.

  3. Create a column structure information file.

  4. Execute the adbimport command.

Using examples, the following subsections explain each of these steps.

Organization of this subsection

(1) Creating an input data path file

This example creates an input data path file and specifies in it the paths of the two input data files.

Example of an input data path file
/mnt/diska/wwwww/imp1.csv
/mnt/diskb/xxxxx/imp2.csv

(2) Creating an import option file

This example creates an import option file that specifies import options.

Example of an import option file
set adb_import_errdata_file_name = "/home/adbmanager/imp_file/errdata.csv"   ...1
set adb_import_errdata_num = 500                                             ...2
set adb_import_rthd_num = 2                                                  ...3
set adb_import_sort_buff_size = 2
           :
Explanation:
  1. Specifies a logical error data file to which logical error data can be output.

  2. Specifies the maximum number of logical error data items that can be output.

  3. Specifies other performance-related import options.

(3) Creating a column structure information file

This example creates a column structure information file that specifies column structure information options.

Example of column structure information file
adbcolumninfo -n C1  -r 2
adbcolumninfo -n C2  -r 3
adbcolumninfo -n C3  -r 1
Explanation:

Specifies how to handle input data for each column (C1, C2, and C3) defined for the table to be processed.

For details about the specification patterns for column structure information options for each combination of contents of input data files and the column definition for the table to be processed, see (1) When the file format of the input data files is CSV in 17.2.5 Specification patterns for the column structure information options.

(4) Executing the adbimport command

adbimport -u ADBUSER01                             ...1
          -p '#HelloHADB_01'                       ...2
          -k "'"                                   ...3
          -s ,                                     ...4
          -g 10                                    ...5
          -w /home/adbmanager/tmp                  ...6
          -z /home/adbmanager/imp_file/env01.txt   ...7
          -r /home/adbmanager/imp_file/clm01.txt   ...8
          TABLE01                                  ...9
          /home/adbmanager/imp_file/inf01.txt      ...10
Explanation:
  1. Specifies the authorization identifier of the HADB user who executes the adbimport command.

  2. Specifies the password for the authorization identifier that is specified in the -u option.

  3. Specifies the enclosing character (single quotation mark) used in input data files. To specify a single quotation mark for the enclosing character, you must enclose the single quotation mark between double quotation marks (").

  4. Specifies the delimiter (comma) used in input data files.

  5. Specifies that a data import progress message (KFAA80205-I) is to be output after every 10,000 rows.

  6. Specifies a directory for storing temporary work files that will be created during data import processing.

  7. Specifies the absolute path name of the import option file created in (2) Creating an import option file.

  8. Specifies the absolute path name of the column structure information file created in (3) Creating a column structure information file.

  9. Specifies the table subject to import processing (TABLE01).

  10. Specifies the absolute path name of the input data path file created in (1) Creating an input data path file.