Reputation: 1
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
Upvotes: 0
Views: 14367
Reputation: 11
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
Upvotes: 0
Reputation: 1043
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
Upvotes: 2
Reputation: 2833
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.
Upvotes: 1