Available starting from release Netezza client 7.2.1:
Download client form IBM fix central:
Download client form IBM fix central:
See download selection option in this post:
Unzip and install NzAdmin.exe into new directory:
Example: C:\Program Files (x86)\IBM Netezza Tools 7.2.1-1\Bin
::: Set PATH variable permanently so nzsql command can be seen. :::
setx Path=%Path%;<inst dir like C:\Program Files (x86)\IBM Netezza Tools 7.2.1-1\Bin>
::: Set environment variables permanently :::
setx NZ_HOST "netezza_server_1"
setx NZ_DATABASE "SYSTEM"
setx NZ_USER "john.x.dough"
setx NZ_PASSWORD "abc123"
C:\Users\john.x.dough>nzsql
Welcome to nzsql, the IBM Netezza SQL interactive terminal.
Type: \h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
SYSTEM.ADMIN(john.x.dough)=> \l
List of databases
DATABASE | OWNER
----------------+--------------
BIGQA | BIGADMIN
BIGSTGDEV | BIGADMIN
BIGSTGPR | ADMIN
BIGSTGQA | BIGADMIN
FINGDEV | ADMIN
FINQA | ADMIN
RPTDEV | RPTADMIN
DATABASE | OWNER
----------------+--------------
BIGQA | BIGADMIN
BIGSTGDEV | BIGADMIN
BIGSTGPR | ADMIN
BIGSTGQA | BIGADMIN
FINGDEV | ADMIN
FINQA | ADMIN
RPTDEV | RPTADMIN
SYSTEM.ADMIN(john.x.dough)=> \?
\a toggle between unaligned and aligned mode
\act show current active sessions
\c[onnect] [dbname [user] [password]]
connect to new database (currently 'SYSTEM')
\C <title> HTML table title
\copy ... perform SQL COPY with data stream to the client machine
\d <table> describe table (or view, index, sequence, synonym)
\dO <table> describe table or view in sorted order
\d{t|v|i|s|e|x} list tables/views/indices/sequences/temp tables/external tables
\d{m|y} list materialized views/synonyms
\dS{t|v|i|s} list system tables/views/indexes/sequences
\dM{t|v|i|s} list system management tables/views/indexes/sequences
\dp <name> list user permissions
\dpu <name> list permissions granted to a user
\dpg <name> list permissions granted to a group
\dgp <name> list grant permissions for a user
\dgpu <name> list grant permissions granted to a user
\dgpg <name> list grant permissions granted to a group
\d{u|U} list users/User Groups
\d{g|G|Gr} list groups/Group Users/Resource Group Users
\da[+] [name] list aggregates, + for additional fields
\dd [object] list comment for object
\df[+] [name] list functions, + for additional fields
\dl[+] [name] list libraries, + for additional fields
\do list operators
\dT list data types
\e [file] edit the current query buffer or [file] with external editor (N
ot supported on Windows)
\echo <text> write text to stdout
\f <sep> change field separator
\g [file] send query to backend (and results in [file] or |pipe)
\h [cmd] help on syntax of sql commands, * for all commands
\H toggle HTML mode (currently off)
\i <file> read and execute queries from <file>
\l list all databases
\o [file] send all query results to [file], or |pipe
\O [filename] send query output with errors to filename (or |pipe)
\p show the content of the current query buffer
\pset <opt> set table output <opt> = {format|border|expanded|fieldsep|null|recordsep|tuples_only|title|tableattr|pager}
\q quit nzsql
\qecho <text> write text to query output stream (see \o)
\r reset (clear) the query buffer
\s [file] print history or save it in [file] (Not supported on Windows)
\set <var> <value> set internal variable
\t show only rows (currently off)
\time print time taken by queries
\T <tags> HTML table tags
\unset <var> unset (delete) internal variable
\w <file> write current query buffer to a <file>
\x toggle expanded output (currently off)
\! [cmd] shell escape or command (Not supported on Windows)
SYSTEM.ADMIN(SERGEY.X.DOUBOV)=>
C:\Users\john.x.dough>nzsql -h
This is nzsql, the IBM Netezza SQL interactive terminal.
Usage:
nzsql [options] [security options] [dbname [username] [password]]
Security Options:
-securityLevel Security Level you wish to request (default: preferredUnS
ecured)
-caCertFile ROOT CA certificate file (default: NULL)
Options:
-a Echo all input from script
-A Unaligned table output mode (-P format=unaligned)
-c <query> Run only single query (or slash command) and exit
-d <dbname> Specify database name to connect to (default: SYSTEM)
-D <dbname> Specify database name to connect to (default: SYSTEM)
-schema <schemaname> Specify schema name to connect to (default: $NZ_SCHEMA)
-e Echo queries sent to backend
-E Display queries that internal commands generate
-f <filename> Execute queries from file, then exit
-F <string> Set field separator (default: "|") (-P fieldsep=)
For any binary/control/non-printable character use '$'
(e.g., nzsql -F $'\t' // for TAB)
-host <host> Specify database server host (default: netezza_wdc_dev)
-h <host> Specify database server host (default: netezza_wdc_dev)
-H HTML table output mode (-P format=html)
-l List available databases, then exit
-n Disable readline
-o <filename> Send query output to filename (or |pipe)
-O <filename> Send query output with errors to filename (or |pipe)
-port <port> Specify database server port (default: hardwired)
-P var[=arg] Set printing option 'var' to 'arg' (see \pset command)
-q Run quietly (no messages, only query output)
-r Suppress row count in query output
-R <string> Set record separator (default: newline) (-P recordsep=)
-Rev Show version information and exit
-rev Show version information and exit
-s Single step mode (confirm each query)
-S Single line mode (newline terminates query)
-t Print rows only (-P tuples_only)
-time Print time taken by queries
-T text Set HTML table tag options (width, border) (-P tableattr= )
-u <username> Specify database username (default: SERGEY.X.DOUBOV)
-U <username> Specify database username (default: SERGEY.X.DOUBOV)
-v name=val Set nzsqlvariable 'name' to 'value'
-V Show version information and exit
-w Don't require password, other mechanisms (Kerberos) will supply it
-W <password> Specify the database user password
-pw <password> Specify the database user password
-x Turn on expanded table output (-P expanded)
-X Do not read startup file (~/.nzsqlrc)
-h or -? or --help Display this help
For more information, type "\?" (for internal commands) or "\help" (for SQL commands) from within nzsql.
How to use \d{u|U} to list out all users? Thanks.
ReplyDelete