Karthick88it
Karthick88it

Reputation: 623

Loading data to Netezza using nzload utility

I am trying to load data into Netezza database using "nzload" utility. The control file is as below and it works without any issues.

Is there a way to provide multiple data files as the input in a single control file?

DATAFILE C:\Karthick\data.txt        
{
    Database    test1
    TableName   test
    Delimiter   '%'
    maxErrors    20
    Logfile     C:\Karthick\importload.log
    Badfile     C:\Karthick\inventory.bad
}

Upvotes: 0

Views: 743

Answers (2)

Kiran K G
Kiran K G

Reputation: 11

Yes, you can specify multiple data files in single control file. Those data files can be loaded to same table or different tables. See an example at https://www.ibm.com/docs/en/psfa/7.2.1?topic=command-nzload-control-file

Following are two data files "/tmp/try1.dat" and "/tmp/try2.dat" to be loaded in a table "test" in "system" database:

[nz@nps ]$ cat /tmp/try1.dat
1
2
[nz@nps ]$ cat /tmp/try2.dat
3
4

Following control file defines two "DATAFILE" blocks one for each data file.

[nz@nps ]$ cat /tmp/try.cf
DATAFILE /tmp/try1.dat
{
    Database    system
    TableName   test
    Delimiter   '|'
    Logfile     /tmp/try1.log
    Badfile     /tmp/try1.bad
}
DATAFILE /tmp/try2.dat
{
    Database    system
    TableName   test
    Delimiter   '|'
    Logfile     /tmp/try2.log
    Badfile     /tmp/try2.bad
}

Load the data using "nzload -cf" option and verify that data is loaded.

[nz@nps ]$ nzload -cf /tmp/try.cf
Load session of table 'TEST' completed successfully
Load session of table 'TEST' completed successfully
[nz@nps ]$ nzsql -c "select * from test"
 A1
----
  2
  3
  4
  1
(4 rows)

Upvotes: 1

Mark F
Mark F

Reputation: 291

    $ cat my_control_file
    datafile my_file1 {}
    datafile my_file2 {}
    datafile my_file3 {}
    datafile my_file4 {}

# Below, I specify many of the options
# on the command line itself ... so I don't have
# to repeat them in the control file.

    $ nzload -db system -t my_table -delim "|" -maxerrors 10 -cf my_control_file
    Load session of table 'MY_TABLE' completed successfully
    Load session of table 'MY_TABLE' completed successfully
    Load session of table 'MY_TABLE' completed successfully
    Load session of table 'MY_TABLE' completed successfully

Upvotes: 1

Related Questions