Like any other database such as Oracle, Netezza also allows you to load data using control files. In this article, we will discuss about the Netezza nzload control files and its syntax with examples.
Using a nzload control file, you can define load operations in a text file instead of having to specify options on the command line. You can specify the information such as data file name, log file details etc in control file.
You can also use control files to run multiple concurrent table loads, with different options inside same control file, in one command instance.
Read:
- Netezza Fixed-Width Data loading and Examples
- Netezza nzload merge Operations
- Guide to Load data into Netezza Database
- nzload command and its usage
- Netezza Export Table Data to CSV Format
- IBM Netezza Unload Table using External Tables and Examples
Netezza nzload Control File Options
You can specify the many of the Netezza external table option in control files.
You can read my other post on Netezza External Table and Examples.
Below are some basic options that you can provide in Control file:
Option | Description |
badfile (bf) | Specifies the name of the nzbad file |
database | Specifies the name of the database that contains the table into which you are loading data. |
datafile | Specifies the path name of the file that you want to load into the specified table, schema, and database. |
Logfile (lf) | Specifies the name of the nzload log file |
schema | Specifies the schema into which to load the data. |
tablename | Specifies the name of the table into which to load the data |
Netezza nzload Control File Syntax and Example
The syntax for using a control file is as follows:
DATAFILE /home/data/datafile.dat { [<option name> <option value>]* }
The datafile option must be the first line of the control file, followed by list of control file options in curly braces {}. You can specify more than one data file, each with its own set of options, in the control file.
Following control file is used to load the data from test.dat into test table.
DATAFILE /home/data/test.dat { Database training schema test1 TableName test Delimiter '~' Logfile test.log Badfile test.bad }
Save the above control file content to something like test.ctl then run Netezza nzload by passing this control file as parameter.
[nz@netezza]$ nzload -db TRAINING -cf /home/data/control/test.ctl Load session of table 'TEST' completed successfully