Wednesday, September 14, 2016

IBM Netezza DBA SQL Queries

IBM Netezza DBA SQL Queries


SQL to find list of views, Owner and their definitions in a NZ DB:
SELECT VIEWNAME,OWNER,DEFINITION FROM _V_VIEW WHERE OBJTYPE='VIEW';
SQL to get a list of tables in a database:
SELECT TABLENAME, OWNER, CREATEDATE FROM _V_TABLE WHERE OBJTYPE='TABLE';

or connect to database like below

nzsql –d PROD
nzsql>\d

SQL to find a list of columns from a table or a view:

SELECT ATTNUM, ATTNAME FROM _V_RELATION_COLUMN WHERE NAME=UPPER('<TABLE NAME>')
ORDER BY ATTNUM ASC;

SQL to find list of user groups on the box:

SELECT GROUPNAME,OWNER,CREATEDATE,ROWLIMIT,SESSIONTIMEOUT,
QUERYTIMEOUT,DEF_PRIORITY,MAX_PRIORITY FROM _V_GROUP;

SQL to find list of users and the groups they are in, on the box:

SELECT GROUPNAME, OWNER, USERNAME FROM _V_GROUPUSERS where GROUPNAME='PROD_RO' ;


Netezza NZSQL command:--

\dt                          --- In nzsql session to find the list tables
\dv                         ---To get list of views
\dmv                      ---List of materialized views
\l                            ---List of databases
\dg                         ---List of groups
\du                         ---List of users
\dpu                       ---Permissions set to a user
\dT                         ---List of datatypes
\d <tab_name>      ---DESC the table
\act                        ---Show current active sessions
\df                          ---List functions
\l                            ---List databases
\dT                         ---List data types
\du                         ---List users
\dg                         ---List groups
\dpu                       ---List permissions granted to a user
\dpg                       ---List permissions granted to a group

3 comments:

  1. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor led live training in IBM Netezza, kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on IBM Netezza. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us.
    Nitesh Kumar
    MaxMunus
    E-mail: nitesh@maxmunus.com
    Skype id: nitesh_maxmunus
    Ph:(+91) 8553912023
    http://www.maxmunus.com/


    ReplyDelete
  2. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Big Data Hadoop and Spark Developer, kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on Netezza Training. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us.
    Sangita Mohanty
    MaxMunus
    E-mail: sangita@maxmunus.com
    Skype id: training_maxmunus
    Ph:(0) 9738075708 / 080 - 41103383
    http://www.maxmunus.com/


    ReplyDelete
  3. Hello,
    Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging… IBM Netezza DBA

    ReplyDelete