0

I'm completely new to Netezza. I've connected to Netezza server through a putty access and need to run an nzsql command in the Linux terminal but when I give nzsql, it says command not found. Can someone tell me how to get started with nzsql and execute queries ?

Thanks in advance

Arpan
  • 596
  • 2
  • 10
  • 29
user3660232
  • 1
  • 1
  • 1
  • 1

3 Answers3

2

You need to install NzClient to run nzsql from staging machine, Please read following link -

http://bajajvarun.blogspot.in/2014/02/install-netezza-client-on-ubuntu.html
Varun Bajaj
  • 1,033
  • 8
  • 16
1

Most likely the nzsql command is not on your path.

http://pic.dhe.ibm.com/infocenter/ntz/v7r0m3/index.jsp?topic=%2Fcom.ibm.nz.adm.doc%2Fr_sysadm_nzsql_command.html indicates the location of the commands, so if you are on the Netezza host the command is expected to be in /nz/kit/bin.

Does typing "/nz/kit/bin/nzsql" find the command? If so, add that directory to your path. If not, check with someone who can run the command to see what "which nzsql" shows, and add that directory to your path.

mc110
  • 2,825
  • 5
  • 20
  • 21
0

If you want the nzsql commands then try something like:

nzsql -host -d -u -pw -c -c "select * from tablename" -o /root/home/outputfilename.txt;

nzsql -host -d -u -pw -c "select * from tablename" -F "|" -A -q -t | gzip > /root/home/outputfilename.txt.gz;

nzsql -host -d -u -pw -c 'insert into tablename values (1 ,2 )' -o /root/home/outputfilename.txt;

http://dwbitechguru.blogspot.ca/2014/11/extract-load-migrate-filesdata-from.html

or use them from unix scripts:

#  Unix Script to Drop & Truncate a Netezza tables
#!/bin/sh
# enter your database name and table name in below
dbname=exampledb
tblname=exampletbl
echo "Dropping table $i"
# use below line to drop a table 
nzsql $dbanme -c "drop table $tblname"
# use below line to truncate a table 
nzsql $dbanme -c "truncate table $tblname"

http://dwbitechguru.blogspot.ca/2014/12/how-to-create-unix-script-to-drop.html

prady3041
  • 11
  • 1