Friday, October 24, 2014

how to update the contact details on NPS server?

use the below file to edit the contact details on NPS server?
/nz/data.1.0/config/callHome.txt

how to find rollback status in Netezza Database?

you can view the below query to check the roll back status.
select XID,START_TIME,TIME_REMAINING from _V_ROLLBACK_STATUS;

how to check count of all objects in NPS?

nzstats -type dbms

Field Name          Value
------------------- -----
Num Databases       11
Num Groups          11
Num Users           72
Num Tables          7801
Num Views           203
Num SQL Sessions    7
Num Queries         0
Num Queries Running 0
Num Queries Waiting 0
Num Transactions    1

how to check overall health of Netezza system?

nz_health will tell you overall health of system
Hw issues,S?W issue/code issues/failed sidk,disk details etc.

how to check H/w status on NPS?

nzhw -issues
============
No entries found

nzds -issues
============
No entries found

nzds -regenStatus
=================
No entries found

how to check the groom status of database?

progress/status of ongoing GROOM operations can be monitored via the
          system view _V_GROOM_STATUS


 nz_groom  [dbname [tablename <...>]]  [ optional args ]

Purpose:  A wrapper around the 'groom' command to provide additional functionality.

               nz_reclaim  is automatically invoked when running NPS 4.x and 5.x
               nz_groom    is automatically invoked when running NPS 6.x +

Inputs:   The database name is optional.  If not specified then all databases will be
          processed.

          The tablename is optional.  If not specified then all tables in the database
          will be processed.  Or, you can specify one (or many) tablenames to be
          processed.

          -scan        The default option.  This will report on the amount of space
                       that would be reclaimed IF you were to do a

                            "groom table <name> records all;"

                       Gathering this information simply involves a full table scan.

          -pages       Run a page based groom against the entire table.

                       Any empty pages (128KB) will be removed from the scan list (although
                       they will still exist in the table).  Any empty extents (3MB) will
                       be removed the from table.

                       Where "empty" means that the page/extent only contains deleted rows,
                       and those rows are currently reclaimable -- i.e. not of interest.

                            "groom table <name> pages all;"

                       The goal here is to remove as many rows as possible ...  using the
                       fastest method possible.

          -records     Run the actual "groom table <name> records all;" against the
                       table.  This option will, by far, take the longest to run as
                       it basically involves a read+rewrite of the entire table.
                       Therefore, when you choose this option, the script will
                       automatically do the following:

                       a)  First perform the "-pages" operation, since it is faster
                           to throw away pages/extents of data, than individual records.

                       b)  Then perform the "-scan" operation to see if there are
                           any rows that actually need reclaiming.  If not, we'll
                           be able to skip the actual record level grooming as that
                           would not be of any benefit.

                       c)  IF, and only IF, a record level groom is warranted, it
                           will then be run against the table.  (The table must
                           have reclaimable rows, and must meet/exceed any  of the
                           following thresholds that you are allowed to specify).

                       The following switches are optional, and apply to the
                       -scan/-records options.  They can be used in any combination
                       to limit the output report to just those tables that meet/
                       exceed the specified thresholds.  If multiple conditions are
                       specified, they will be OR'ed together.

                       If a table does not meet at least one of the thresholds it
                       will not be included in the report (the "-scan" option) nor
                       will the script do a record level groom against the table
                       (the "-records" option).

                       -rows    <nnn>     # Example:  -rows 1000000
                                          # Only show tables with >= 1M reclaimable rows

                       -percent <nnn>     # Example:  -percent 50
                                          # Only show tables where >= 50% of the rows
                                          # are reclaimable

                       -size    <nnn>     # Example:  -size 1000000000
                                          # Only show tables with >= 1 GB of reclaimable
                                          # space

                       If no thresholds are specified, then:
                            o  All tables will be displayed
                                    (for purposes of the "-scan" option).
                            o  Only tables with >= 1 reclaimable row will be reclaimed
                                    ("-records" option)

          -records <all|ready>

                       There may be times when you want to FORCE a record level groom
                       to be performed (even if there are no logically deleted rows in
                       the table to be reclaimed).  For example:
                            o)  To rewrite a table, after you have enabled compression,
                                so that it will now be compressed
                            o)  To "organize" the rows within a clustered base table.

                       This option allows you to FORCE the record level groom (of your
                       choosing) to be performed.  Note that this script will skip the
                       initial page level groom, and subsequent scan, of each table ...
                       as that just adds additional overhead, and it won't make any
                       difference (since the script is always going to end up doing the
                       record level groom that you requested anyway).

          -mview       If a table has one (or more) active materialized views associated
                       with it, the table cannot be groom'ed until any such MView has been
                       suspended.  So, by default, this script will skip over those tables.

                       Add this switch to the command line if you want the script to
                       o  Automatically suspend any such materialized views
                       o  Perform the GROOM operation
                       o  Refresh the materialized views upon completion

          -version     If you have a versioned table (which is the result of doing an
                       'ALTER TABLE <table> [ADD|DROP] COLUMN ...' operation against
                       it), then the ONLY groom operation that is allowed against the
                       table is a GROOM VERSIONS.  By default, this script will skip
                       over any such table.

                       Add this switch to the command line if you want the script to
                       automatically do a GROOM VERSIONS against such tables.

          -backupset <[backupsetid | NONE]>

          This switch will allow you to override the default backupset.  If used, this
          information is simply passed along to the "groom" command for it to handle.

          The system synchronizes your groom request with the most recent backup set to
          avoid reclaiming rows not yet captured by incremental backups. In other words,
          groom will not remove any unbackedup data that has been deleted or updated.

          In addition, groom will not remove any data that an old/outstanding (yet
          still active) transaction might still have an interest in.

          So ... there may very well be logically deleted rows in a table ... that
          groom is not willing to physically delete at this point in time (for the
          above mentioned reasons).  The scripts 'nz_invisible' and 'nz_transactions'
          may be useful in such a situation.

          For additional information, refer to the "System Administrator's Guide"

          For this script to function, you must have SELECT access to the following
          objects:
               _T_BACKUP_HISTORY
               _VT_HOSTTXMGR

Notes:    If an unexpected error is encountered at any point in time, this script
          will echo the error message and then exit.  It will not continue processing
          other tables if any problem is encountered.

          The progress/status of ongoing GROOM operations can be monitored via the
          system view _V_GROOM_STATUS

Outputs:  For the default "-scan" option, a report such as this will be produced.

          The "Size"s are estimates (based on each table's average row size).

          The "Remaining Rows/Remaining Size" represents what would remain in the
          table once the actual "groom table <name> records all;" is processed.
          This includes visible rows -- as well as deleted rows that cannot yet
          be groom'ed (for whatever reason).

          The "NON-Groomable Rows" column represents the number of deleted rows that
          are NOT elgible for grooming at this point in time, which may be due to
               o  an outstanding transaction that might have an interest in them
               o  the rows have not yet been captured in the most recent backup set

     Name       Remaining Rows Remaining Size Reclaimable Rows Reclaimable Size NON-Groomable Rows
     --------   -------------- -------------- ---------------- ---------------- ------------------

how to List the administrative privileges that a user has been granted to a database.

nz_get_admin  [-user <user>]  <database>

To list out ALL of the objects that a given user has access to

 nz_my_access  <username>  [-nopublic]

nz_get_acl

how to collect statistic on Netezza tables

nz_genstats  [-info]  [-full|-express|-basic]  <database>  [table ...]

Purpose:  Generate statistics on those tables that don't have up-to-date statistics.

          The optimizer uses statistics to guide its decisions on how best to
          execute a query.  The more reliable and up-to-date the statistics are,
          the more accurate the optimizer's decisions are likely to be.

          You can easily "GENERATE STATISTICS;" for an entire database;

          Or you could issue a  "GENERATE STATISTICS ON <table>;"
                          or a  "GENERATE EXPRESS STATISTICS ON <table>;".
          In this case, you must issue the sql statement on a table-by-table basis.

          But what if a given table already has up-to-date statistics?  Then
          regenerating statistics for it would be a waste of your time and the
          system's resources.

          This script first checks the state of the statistics for each table,
          and then only regenerates statistics on those tables that have outdated
          statistics.  (Statistics are either 100% up-to-date+accurate+reliable,
          or they aren't at 100%.  There is no other statistical measure that
          measures statistics).

          Note: If you wish to get/display the current statistic values for any
          given table you can use the script "nz_get"

Inputs:   The database name is required.

          The table name is optional.  If not specified then all tables in the
          database will be checked, and the statistics refreshed as appropriate.

          Or, you can specify one (or many) table names to be checked.

          If you have a file that contains a list of tablenames to be checked,
          it can be used via the following syntax:

                 nz_genstats  DBNAME  `cat /tmp/the_list_of_tables`


          -info     An optional switch

          If included, then statistics won't actually be generated on any table.
          Instead, this script will simply report information about what tables
          have up-to-date statistics and what tables need to have statistics
          generated against them.


          [-full|-express|-basic]     An optional switch

          You can control whether FULL, EXPRESS, or BASIC stats are generated for
          the tables.  (For an explanation of the difference between the three
          choices, see "nz_get -help" ).  If not specified, then this script will
          adhere to whatever type of stats each individual table currently has
          associated with it.

          Full statistics take the longest to generate -- but provide more accurate
          dispersion information (the # of unique values) for each column.

          Express statistics use a faster (but less accurate) mathematical formula
          to determine the dispersion.

          Basic statistics can be generated the fastest -- because they skip the
          dispersion calculation entirely.  (This is new as of NPS Version 4.6).

          Full statistics are recommended for smaller dimension tables ... which
          usually have fewer rows ... where the accuracy of the dispersion value
          tends to have more of an impact on query planning.

          For larger fact tables, express statistics or basic statistics are
          typically used because of the time savings in generating the statistics.

          [-min <nnn>]     Optional  switches     (default is -min 0)
          [-max <nnn>]                            (default is -max 99999999999999999)

          These switches allow you to control which tables are to have a GENSTATS
          run against them ... based on their table rowcount being between the -min
          and -max values specifed.  The default is for all tables to be included.
          Example: Specifying  '-max 1000000'  will result in only tables with
          <= 1M rows having a GENSTATS performed against them (and then only if
          necessary ... if the statistics aren't already up-to-date).

Outputs:  Sample output.  The first run included the "-info" switch.  No changes
          to the database were made.  The script simply lists what it WOULD have
          done if you let it.

          The second run actually invoked GENSTATS on three of the tables.  The
          elapsed runtime for the individual operations is included.

how to check statistic value of table in NPS

use nz_get to get the value of statistic status.

Usage:    nz_get  [ database [ table ]]

Purpose:  Get (and display) the statistics for a user table or a system table.

          Statistics are used by the NPS optimizer in order to plan the best
          way to run each SQL query (for queries that are run against user data,
          and also for queries that are run against the system catalogs).

          Some of these statistics are automatically maintained by the system
          (i.e., 'always-there' statistics).  Other values are dynamically
          calculated+saved when a "GENERATE [EXPRESS] STATISTICS" command is
          issued.

          This script will dump out all of the known statistics for a table.

Inputs:   The database and table names are optional.  If not specified, then
          all tables in all databases will be reported upon.

          In lieu of a table name, you may instead specify a synonym name or
          materialized view name -- in which case the statistics for the
          underlying table will be displayed.

          The table name may also be any one of the "SYSTEM TABLE" or
          "MANAGEMENT TABLE" names.

          o     For a list of these names, see 'nz_get_sysmgmt_table_names'

          o     By default, normal (non-ADMIN) users do not have access
                to any of these SYSTEM/MANAGEMENT tables.  They are only
                allowed to access them indirectly (thru SYSTEM/MANAGEMENT
                views).

          o     Some of these tables are global in nature, so it does not
                matter which database name you specify on the command line.
                The results will always be the same.  e.g. _VT_SPU_ZMAP_INFO

          o     Some of these tables are local in nature (database specific)
                so the database you specify is relevant.  e.g. _T_ATTRIBUTE

          o     If you wanted to look at the statistics for all of the
                SYSTEM/MANAGEMENT tables, you could issue a command such as this:

                for TABLE in `nz_get_sysmgmt_table_names system`; do nz_get system $TABLE; done

Outputs:  The output of this script will include the following information

            Database:     name, objid

               Table:     name, objid, distribution clause, row count(statistic)

          Per-Column:     attnum              the logical column number (from 1-1600)
                          Column Name
                          Statistics Status   the validity/freshness of the statistics
                          Minimum Value
                          Maximum Value
                          # of Unique Values  also known as the dispersion value
                          # of NULLs
                          MaxLen              The MaxLen+AvgLen are only collected for
                          AvgLen              columns of type VARCHAR, NCHAR, NVARCHAR


          Regarding the "Statistic Status" ... the following indicates that statistics
          have been explicitly generated against this table/column (via a GENSTATs
          command) and that they are 100% up-to-date.  The ONLY difference between the
          three is in how the "# of Unique Values" (the dispersion) is generated.
          The disperion value is the most complex statistic to gather, in terms of time +
          memory + cpu usage.

          Full        Similar to doing a "COUNT(DISTINCT columname)".  It generates the
                      most accurate dispersion value, but has the most overhead associated
                      with it.
          Express     It uses math to estimate the dispersion value (a hash is generated
                      for each column value, and then the number of unique hash keys is
                      added up).  Much faster, but less precise.
          Basic       The dispersion calculation is skipped entirely.  All of the other
                      "basic" statistics are still collected.

          So, statistics are either 100% correct and up-to-date, or they're not.  Any change
          to a table ... even if it involves just 1 row being inserted/updated/deleted  ...
          results in the statistics no longer being 100% up-to-date.  In other words, they
          would be outdated.  This doesn't mean that they would be bad or wrong.  Just outdated.

          When rows are nzload'ed/INSERT'ed into a table, NPS automatically compares
          each column value against the MIN/MAX statistic for the column, and updates the
          table's statistics accordingly.  This is also referred to as "always there
          statistics".  This applies to all columns/all datatypes -- EXCEPT for text
          columns (CHAR, NCHAR, VARCHAR, NVARCHAR).  So that means that the MIN/MAX values
          for the column are still OK -- they are still up-to-date (at the same time, the
          table's rowcount statistic is also updated).  But the other statistics values
          (the dispersion and # of nulls) are not up-to-date as they can only be recomputed
          via an explicit GENSTATS.  In this case, the "Statistics Status" will show

          Full    Min/Max OK
          Express Min/Max OK
          Basic   Min/Max OK

          As mentioned, this doesn't apply to text columns.  So all of the statistics that
          are maintained for text columns would be outdated ... and can only be refreshed
          via an explicit GENSTATS.  In this case, the "Statistics Status" will show

          Full    Outdated
          Express Outdated
          Basic   Outdated

          If you never ever bothered to do a GENSTATS on a particular table, then the only
          per-column statistics that would be available are the "always there statistics"
          that NPS automatically collects.  So this means you will have MIN/MAX statistics
          (and only MIN/MAX statistics) for those columns.  Which will be displayed as

          Min/Max Only

          As mentioned, "always there statistics" aren't collected for text columns.  So
          if you've never done an explicit GENSTATS ... and if NPS has never automatically
          collected any statistics ... then there will be no statistics at all available
          to the optimizer.  In this case the "Statistics Status" will show

          Unavailable

          Other situations in which "Unavailable" will be used
          o   if the table is empty
          o   if you've loaded a compressed external file into an empty table

          We don't attempt to collect statistics on very wide text columns, which are
               CHAR/VARCHAR   columns with a defined length >= 24565
               NCHAR/NVARCHAR columns with a defined length >=  6142
          The "Statistics Status" for those columns will be displayed as

          not maintained


          Regarding "always there statistics" ...

          when rows are nzload'ed/INSERT'ed into a table we can easily compare the column
          values against the MIN+MAX statistics, and update them accordingly (if needed)

          when rows are DELETE'd from a table, even though you might be deleting a row
          that matches a particular MIN value or a particular MAX value, there is no
          way to answer the following
               a)  is this the only row in the table with that particular value ?
               b)  and if so, what is the next MIN value or the next MAX value ?
          The only way to determine those answers is via a GENSTATS (which processes
          every row in the table).  Thus, a DELETE operation never shrinks the
          MIN/MAX values.  But we still know that we can use+trust those statistics ...
          that there is no value in the table column that is outside the current
          MIN/MAX range.

          when rows are UPDATE'd, we actually do an INSERT+DELETE.  See above.


          Regarding GENERATE [EXPRESS] STATISTICS ...

          as of 4.6, there is really only one GENERATE STATISTICS command now.  Both
          GENERATE STATISTICS and GENERATE EXPRESS STATISTICS do the same thing.
          GENERATE EXPRESS STATISTICS will someday be retired.

          the only difference between the two has been in how they calculate the
          "# of Unique Values" ... the dispersion value ... for a column.  That
          still occurs, but now NPS decides for itself which method to use.

          If       the table's rowcount is <= 10 * SPU_COUNT
          Then     FULL stats will be collected
                   where we actually try to do a COUNT(DISTINCT on_each_column)
                   # Of Columns Processed Per Scan:  set STATS_COL_GRP_LIMIT = 10;

          If       the table's rowcount is <= JIT_DISP_MIN_ROWS (the default is 500,000,000)
          Then     EXPRESS stats will be collected
                   where we hash the column values to approximate the dispersion value
                   # Of Columns Processed Per Scan:  set SAMPLED_STATS_COL_GRP_LIMIT = 50;

          Else     we skip the dispersion calculation alltogether (all other statistics
                   for the column will still be gathered)
                   # Of Columns Processed Per Scan:  currently unbounded