Hitachi

Hitachi Advanced Database Setup and Operation Guide


9.6 Importing data into a base table

After you have defined a base table, you use the adbimport command to import data into it.

Example:

This example imports data into the shop table (SHOPSLIST).

Procedure:

  1. Log on to the OS from the HADB administrator's OS account.

    Log on to the OS from the HADB administrator's OS account so that the HADB administrator can execute the adbimport command.

    This step is not necessary if the HADB administrator is already logged on.

  2. Create input data path files.

    /home/adbmanager/imp_data/imp1.csv
    /home/adbmanager/imp_data/imp2.csv

    Create input data path files that specify input data file paths. The input data files created here become the input information for the adbimport command.

    In this example, the created input data path files are saved in /home/adbmanager/imp_file/imp_data_path.txt.

  3. Create an import option file.

    set adb_import_errdata_file_name = "/home/adbmanager/imp_shopslist/errdata.csv"
    set adb_import_errdata_num = 500
    set adb_import_rthd_num = 2
    set adb_import_sort_buff_size = 2
                   :

    Create an import option file that specifies an import option. The import option file created here becomes the input information for the adbimport command.

    In this example, the created import option file is saved in /home/adbmanager/imp_file/imp_opt_file.txt.

    For details about import options, see Format of import options in Specification format for the adbimport command under adbimport (Import Data) in the manual HADB Command Reference.

  4. Execute the adbimport command to import data into the shop table (SHOPSLIST).

    adbimport -u ADBUSER02 -p '#HelloHADB_02' -k "'" -s , -g 10
              -w /home/adbmanager/tmp
              -z /home/adbmanager/imp_file/imp_opt_file.txt
              SHOPSLIST
              /home/adbmanager/imp_file/imp_data_path.txt
    -u

    Specifies the authorization identifier of the HADB user who executes the adbimport command. Specify the authorization identifier of the HADB user who owns the table into which data is to be imported.

    -p

    Specifies the password of the HADB user who executes the adbimport command.

    -k

    Specifies the enclosing character used in the input data file.

    -s

    Specifies the delimiting character used in the input data file.

    -g

    Specifies the interval for outputting the progress message for data importing (KFAA80205-I).

    -w

    Specifies the directory for storing the temporary work files that are created during data importing.

    -z

    Specifies the absolute path name of the import option file created in step 3.

    SHOPSLIST

    Specifies the table into which data is to be imported.

    /home/adbmanager/imp_file/imp_data_path.txt

    Specifies the absolute path name of the import data path file created in step 2.