You are on page 1of 3

Important Netezza Considerations

• Use NZ utilities like nzsql, nzload, nzunload and external tables to a mapr-
fs location to read and write data
• When necessary, use a readily-available tool with a wide variety of
connectors (e.g., Sqoop) to simplify importing and exporting data to and
from MapR
• Leverage MapR-FS, NFS, and POSIX to simplify data migration to and
from Netezza
• MapR-FS supports direct and secure access to data using loopback NFS or FUSE-
based POSIX clients
• POSIX client allows app servers, web servers, and other client nodes and apps to
read and write data directly and securely to a MapR cluster, with transmitted data
compressed in both directions
Netezza Utilities Example
Extract - Load - Migrate Files/Data to/from Netezza
It is very easy in Netezza to extract data from netezza tables, load data from files to Netezza target tables, or Migrate data from
one Netezza database to another.Below are few commands that you can use this purpose.
NZSQL utility: This utility can be run from any machine on which it is installed i.e. it does not have be from netezza box itself.
This utility can be used to run any sql statement like select or insert statement on the netezza database. In the below usage you
see data extracted from the table into a output file and in the second mzsql command the data is also gzipped.
Usage:
nzsql -host <netezz_db_servername> -d <database> -u <username> -pw <password> -c  -c  "select * from tablename"  -o
/MAPR/home/outputfilename.txt;

nzsql -host <netezza_db_servername> -d <database> -u <username> -pw <password> -c  "select * from tablename" -F "|" -A -q -t | gzip
> /MAPR/home/outputfilename.txt.gz;
nzsql -host <netezza_db_servername> -d <database> -u <username> -pw <password> -c  'insert into tablename values (1 ,2 )'  -o
/MAPR/home/outputfilename.txt;

NZLOAD utility: This utility can be used to load data from files to netezza target tables. The nzload command usage is below. In the
usage below the flat file which is delimited by | is loaded to a table mentioned with in <target_table_name>. Also user name and
password can be provided for this utility.
nzload -host <netezzahost> -db <database> -u <user name> 
       -pw <password> -delim '|' -t <target_table_name> -df /MAPR/home/outputfilename.txt
Netezza Utilities Example (cont.)
----------------------------------------------------------------------------------------------------
NZ_UNLOAD utility: if instead of nzsql you want to extract files from a netezza table faster by running multiple threads in parallel
then use nz_unload utility. The nz_unload command usage is below:
./nz_unload -sql '"select * from tablename"' -file /MAPR/dba/output/outputfilename.txt
----------------------------------------------------------------------------------------------------
External tables: Another way to migrate data is to create external table and insert the data from external table into the targer
table. External table usage would like shown below:
CREATE EXTERNAL TABLE ’/MAPR/tmp/export.csv' USING (DELIM ',') AS
SELECT * from <TABLENAME>;

INSERT INTO <targettable> SELECT * FROM external '/tmp/export.csv'


USING (DELIM ',');

You might also like