17.3.4 Background importing CSV-format table data compressed in GZIP format
In this example, table data is imported under the following conditions:
-
Background importing table data to the table TABLE01
-
B-tree, text, and range indexes are defined for table TABLE01.
-
There are two input data files (CSV format).
-
The input data files are compressed in GZIP format.
-
Within the input data file, single quotation marks (') are used as enclosing characters, and commas (,) are used as delimiters.
-
Within the input data file, field data fulfills the following two conditions:
-
The field data is placed in the same order as the column structure of the target table to be imported.
-
The number of items of field data is the same as the number of column definitions in the target table to be imported.
-
-
There might be logical errors in the input data.
-
If any data contains a logical error, correct the data before performing background import.
This example uses the following procedure to execute the adbimport command.
- Procedure
-
-
Create an input data path file.
-
Create an import option file.
-
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
In this example, an input data path file is created, and paths are specified for all the input data files.
- Example specification of an input data path file
-
/mnt/diska/wwwww/imp1.csv.gz /mnt/diskb/xxxxx/imp2.csv.gz
(2) Creating an import option file
In this example, an import option file is created, and import options are specified.
- Example specification 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_read_size = 1024 ...3 set adb_import_decompress_buff_size = 1024 :
- Explanation:
-
-
The logical error data file that outputs the logical error data is specified.
-
The maximum number of output items of logical error data is specified.
-
Other import options relating to performance are specified.
-
(3) 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 -b ...8 TABLE01 ...9 /home/adbmanager/imp_file/inf01.txt ...10
- Explanation:
-
-
Specifies the authorization identifier of the HADB user who executes the adbimport command.
-
Specifies the password for the authorization identifier that was specified in the -u option.
-
Specifies the enclosing characters (single quotation marks) to be used within input data files. If you specify single quotation marks as the enclosing characters, note that single quotation marks must be enclosed in double quotation marks (").
-
Specifies the delimiters (commas) to be used within input data files.
-
Specifies to output progress messages (KFAA80205-I) for every 10,000 rows of data import processing.
-
Specifies the directory that stores temporary work files created during data import processing.
-
Specifies the absolute path name of the import option file created in (2) Creating an import option file.
-
Specifies to background import table data.
-
Specifies the target table to be imported (TABLE01).
-
Specifies the absolute path name of the input data path file created in (1) Creating an input data path file.
-