Friday, March 30, 2018

steps to collect stats for Netezza database.

There is an utility to collect the stats on Netezza nz_genstats

z@server name:/export/home/nz> jobs -l
[1]+  9193 Running                 nohup /nz/support/bin/nz_genstats NZ_DB > NZ_DB_genstats_march30.log &
nz@server name:/export/home/nz> jobs -l
[1]+  9193 Running                 nohup /nz/support/bin/nz_genstats NZ_DB > NZ_DB_genstats_march30.log &
You have new mail in /var/spool/mail/nz
nz@server name:/export/home/nz> view NZ_DB_genstats_march30.log

This is how it looks on the database session

nz@server name:/export/home/nz> nzsession

ID      Type     User      Start Time              PID   Database Schema  State  Priority Name Client IP      Client PID Command
------- -------- --------- ----------------------- ----- -------- ------- ------ ------------- -------------- ---------- ------------------------
3046454 sql      ADMIN     30-Mar-18, 16:46:04 EDT 24892 NZ_DB ADMIN active normal             127.0.0.1      24891 GENERATE STATISTICS ON "

Wednesday, March 28, 2018

netezza database table restore using NZ_backup & NZ_restore

Here is the step by step table restore using Netezza utility  nz_backup & nz_restore
pre-request:table must be created prior to restore.


nz@<nz_server_name>:/nzscratch/test> nz_backup -db NZ_PRD1 -t NZ_table_1   -format binary -dir /nzscratch/test

nz_backup of database NZ_PRD1 started on 2018-03-28 11:21:10

                         NZ_HOST:
                         NZ_USER: admin
                     NZ_DATABASE: NZ_PRD1
                Backup Directory: /nzscratch/test
                   Backup Format: binary
                   Custom Script:
                    # Of Threads: 1
                      stableTXid: 6148525
                        lastTXid: 6148610
    This backup is based on TXid: 6148608
    with an invisibility list of: (6148526)
                      Debug Mode: Disabled

=======================================================================================

ERROR: 0 tables were processed !!

       No tables (matching your specifications) were found.
       Or, perhaps this database account doesn't have access to those tables.

=======================================================================================

nz_backup of database NZ_PRD1 finished on 2018-03-28 11:21:10

     Total # of tables processed: 0
     Total # of seconds elapsed : 0

     TOTAL source table size    : 0
     TOTAL backup file size     : 0
     rate  (bytes per second)   : 0
     ratio (source / backup)    : 0

=======================================================================================

nz@<nz_server_name>:/nzscratch/test> nz_find_object NZ_table_1

     The Object Name Is      | It Is Of Type | Its 'objid' Is | In The Database
-----------------------------+---------------+----------------+------------------
 NZ_table_1 | TABLE         |       18413626 | NZ_PRD1_MARCH23
(1 row)

nz@<nz_server_name>:/nzscratch/test> nz_backup -db NZ_PRD1_MARCH23 -t NZ_table_1   -format binary -dir /nzscratch/test

nz_backup of database NZ_PRD1_MARCH23 started on 2018-03-28 11:22:21

                         NZ_HOST:
                         NZ_USER: admin
                     NZ_DATABASE: NZ_PRD1_MARCH23
                Backup Directory: /nzscratch/test
                   Backup Format: binary
                   Custom Script:
                    # Of Threads: 1
                      stableTXid: 6148525
                        lastTXid: 6148616
    This backup is based on TXid: 6148614
    with an invisibility list of: (6148526)
                      Debug Mode: Disabled

=======================================================================================

Info:  table 1 of 1                                               NZ_table_1
Info:  backup  process started                                    2018-03-28 11:22:21
Info:  estimated # of records                                     14,534,983
Info:  unloading data              ( thread 1 of 1 )
Info:  data flowing ...
Info:  unload finished             ( thread 1 of 1 )   seconds    5
Info:  unload results              ( thread 1 of 1 )              INSERT 0 14534983
Info:  data flow finished
Info:  backup  process ended                                      2018-03-28 11:22:26
Info:  source table size                                          947,781,632
Info:  backup file size                                           851,962,520
Info:  rate     (backup file size / # of seconds elapsed)         170,392,504
Info:  ratio    (source table size / backup file size)            1.11
Info:  # of records unloaded                                      14,534,983
Info:  # of seconds elapsed                                       5

=======================================================================================

nz_backup of database NZ_PRD1_MARCH23 finished on 2018-03-28 11:22:26

     Total # of tables processed: 1
     Total # of records unloaded: 14,534,983
     Total # of seconds elapsed : 5

     TOTAL source table size    : 947,781,632
     TOTAL backup file size     : 851,962,520
     rate  (bytes per second)   : 170,392,504
     ratio (source / backup)    : 1.11

=======================================================================================

nz@<nz_server_name>:/nzscratch/test> ls -ltr
total 832816
-rw-r--r-- 1 nz nz 851962520 Mar 28 11:22 NZ_table_1.1
nz@<nz_server_name>:/nzscratch/test> rm NZ_table_1.1
nz@<nz_server_name>:/nzscratch/test>
nz@<nz_server_name>:/nzscratch/test> nz_backup -db NZ_PRD1_MARCH23 -t NZ_table_1   -format binary -dir /nzscratch/test -thread 4

nz_backup of database NZ_PRD1_MARCH23 started on 2018-03-28 11:24:11

                         NZ_HOST:
                         NZ_USER: admin
                     NZ_DATABASE: NZ_PRD1_MARCH23
                Backup Directory: /nzscratch/test
                   Backup Format: binary
                   Custom Script:
                    # Of Threads: 4
                      stableTXid: 6148525
                        lastTXid: 6148624
    This backup is based on TXid: 6148622
    with an invisibility list of: (6148526)
                      Debug Mode: Disabled

=======================================================================================

Info:  table 1 of 1                                               NZ_table_1
Info:  backup  process started                                    2018-03-28 11:24:11
Info:  estimated # of records                                     14,534,983
Info:  unloading data              ( thread 1 of 4 )
Info:  unloading data              ( thread 2 of 4 )
Info:  unloading data              ( thread 3 of 4 )
Info:  unloading data              ( thread 4 of 4 )
Info:  data flowing ...
Info:  unload finished             ( thread 4 of 4 )   seconds    5
Info:  unload results              ( thread 4 of 4 )              INSERT 0 3306067
Info:  unload finished             ( thread 1 of 4 )   seconds    5
Info:  unload results              ( thread 1 of 4 )              INSERT 0 3963043
Info:  unload finished             ( thread 2 of 4 )   seconds    5
Info:  unload results              ( thread 2 of 4 )              INSERT 0 3963680
Info:  unload finished             ( thread 3 of 4 )   seconds    6
Info:  unload results              ( thread 3 of 4 )              INSERT 0 3302193
Info:  data flow finished
Info:  backup  process ended                                      2018-03-28 11:24:17
Info:  source table size                                          947,781,632
Info:  backup file size                                           851,963,336
Info:  rate     (backup file size / # of seconds elapsed)         141,993,889
Info:  ratio    (source table size / backup file size)            1.11
Info:  # of records unloaded                                      14,534,983
Info:  # of seconds elapsed                                       6

=======================================================================================

nz_backup of database NZ_PRD1_MARCH23 finished on 2018-03-28 11:24:17

     Total # of tables processed: 1
     Total # of records unloaded: 14,534,983
     Total # of seconds elapsed : 6

     TOTAL source table size    : 947,781,632
     TOTAL backup file size     : 851,963,336
     rate  (bytes per second)   : 141,993,889
     ratio (source / backup)    : 1.11

=======================================================================================

nz@<nz_server_name>:/nzscratch/test> ls -ltr
total 832844
-rw-r--r-- 1 nz nz 193783237 Mar 28 11:24 NZ_table_1.4
-rw-r--r-- 1 nz nz 232343901 Mar 28 11:24 NZ_table_1.2
-rw-r--r-- 1 nz nz 232283008 Mar 28 11:24 NZ_table_1.1
-rw-r--r-- 1 nz nz 193553190 Mar 28 11:24 NZ_table_1.3
nz@<nz_server_name>:/nzscratch/test> 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)=> \l
           List of databases
           DATABASE           |  OWNER
------------------------------+---------
  NZ_PRD1                     | CVADMIN
 NZ_PRD1_MARCH23             | ADMIN
 NZ_PRD1_OLD                 | ADMIN

 SYSTEM                       | ADMIN
(16 rows)

SYSTEM(ADMIN)=> \q
nz@<nz_server_name>:/nzscratch/test> nz_restore -db NZ_prd2_db_OLD -t NZ_table_1   -format binary -dir /nzscratch/test -thread 4

nz_restore of database NZ_prd2_db_OLD started on 2018-03-28 11:28:49

                         NZ_HOST:
                         NZ_USER: admin
                     NZ_DATABASE: NZ_prd2_db_OLD
                Backup Directory: /nzscratch/test
                   Backup Format: binary
                   Custom Script:
                    # Of Threads: 4
                Using stableTXid: 0
       The lastTXid assigned was: 0
                      Debug Mode: Disabled

=======================================================================================

ERROR: 0 tables were processed !!

       No tables (matching your specifications) were found.
       Or, perhaps this database account doesn't have access to those tables.

=======================================================================================

nz_restore of database NZ_prd2_db_OLD finished on 2018-03-28 11:28:49

     Total # of tables processed: 0
     Total # of seconds elapsed : 0

=======================================================================================

nz@<nz_server_name>:/nzscratch/test> nz_ddl_table NZ_PRD1_MARCH23 NZ_table_1

\echo
\echo *****  Creating table:  "NZ_table_1"

CREATE TABLE  NZ_table_1
(
     LOAD_DATE                         timestamp,
     RCC                               character varying(50),
     NWM_FACILITY_DESC                 character varying(50),
     NWM_CMTS_DESC                     character varying(50),
     NODE_DESC                         character varying(10),
     DATA_DEVICES                      integer,
     TOTAL_CUSTOMERS                   integer,
     NODE_HEALTH_SCORE                 numeric(10,8),
     NODE_HEALTH_SCORE_LAST_3_DAYS     numeric(10,8),
     FLAG                              integer,
     TX_SCORE                          numeric(10,8),
     RCV_SCORE                         numeric(10,8),
     DS_SNR_SCORE                      numeric(10,8),
     DS_CER_SCORE                      numeric(10,8),
     US_SNR_SCORE                      numeric(10,8),
     US_CER_SCORE                      numeric(10,8),
     US_CCER_SCORE                     numeric(10,8),
     CM_T3_SCORE                       numeric(10,8),
     TOTAL_OPEN_TICKETS                integer,
     TOTAL_MODULATIONS_LAST_3_DAYS     integer,
     SUM_DURATION_MIN_PAST_3_DAYS      numeric(10,2),
     TOTAL_OSP_REF                     integer,
     TOTAL_TSG_BUS_REF                 integer,
     TOTAL_TSG_RES_REF                 integer,
     TOTAL_TROUBLE_CALLS               integer,
     CRITICAL                          character varying(3),
     DATE_STAMP                        timestamp,
     KOM_LAST_MODIFIED_DATE            timestamp
)
DISTRIBUTE ON RANDOM
;

/*
       Number of columns  28

    (Variable) Data Size  158 - 322
            Row Overhead  34
  ======================  =============
  Total Row Size (bytes)  192 - 356
*/
nz@<nz_server_name>:/nzscratch/test> 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)=> \l
           List of databases
           DATABASE           |  OWNER
------------------------------+---------
  NZ_PRD1                     | CVADMIN
 NZ_PRD1_MARCH23             | ADMIN
 NZ_PRD1_OLD                 | ADMIN
  SYSTEM                       | ADMIN
(16 rows)

SYSTEM(ADMIN)=> \c NZ_prd2_db_old
You are now connected to database NZ_prd2_db_old.
NZ_prd2_db_OLD(ADMIN)=> CREATE TABLE  NZ_table_1
NZ_prd2_db_OLD(ADMIN)->      RCC                               character varying(50),
     NWM_FACILITY_DESC                 character varying(50),
     NWM_CMTS_DESC                     character varying(50),
     NODE_DESC                         character varying(10),
     DATA_DEVICES                      integer,
     TOTAL_CUSTOMERS                   integer,
     NODE_HEALTH_SCORE                 numeric(10,8),
(
NZ_prd2_db_OLD(ADMIN)(>      RCV_SCORE                         numeric(10,8),
     DS_SNR_SCORE                      numeric(10,8),
     DS_CER_SCORE                      numeric(10,8),
     LOAD_DATE                         timestamp,
NZ_prd2_db_OLD(ADMIN)(>      US_CCER_SCORE                     numeric(10,8),
     CM_T3_SCORE                       numeric(10,8),
     TOTAL_OPEN_TICKETS                integer,
     TOTAL_MODULATIONS_LAST_3_DAYS     integer,
     SUM_DURATION_MIN_PAST_3_DAYS      numeric(10,2),
     TOTAL_OSP_REF                     integer,
     TOTAL_TSG_BUS_REF                 integer,
     TOTAL_TSG_RES_REF                 integer,
     TOTAL_TROUBLE_CALLS               integer,
     CRITICAL                          character varying(3),
     DATE_STAMP                        timestamp,
     KOM_LAST_MODIFIED_DATE            timestamp
)
     RCC                               character varying(50),
NZ_prd2_db_OLD(ADMIN)(>      NWM_FACILITY_DESC                 character varying(50),
NZ_prd2_db_OLD(ADMIN)(>      NWM_CMTS_DESC                     character varying(50),
NZ_prd2_db_OLD(ADMIN)(>      NODE_DESC                         character varying(10),
NZ_prd2_db_OLD(ADMIN)(>      DATA_DEVICES                      integer,
NZ_prd2_db_OLD(ADMIN)(>      TOTAL_CUSTOMERS                   integer,
NZ_prd2_db_OLD(ADMIN)(>      NODE_HEALTH_SCORE                 numeric(10,8),
NZ_prd2_db_OLD(ADMIN)(>      NODE_HEALTH_SCORE_LAST_3_DAYS     numeric(10,8),
NZ_prd2_db_OLD(ADMIN)(>      FLAG                              integer,
NZ_prd2_db_OLD(ADMIN)(>      TX_SCORE                          numeric(10,8),
NZ_prd2_db_OLD(ADMIN)(>      RCV_SCORE                         numeric(10,8),
NZ_prd2_db_OLD(ADMIN)(>      DS_SNR_SCORE                      numeric(10,8),
NZ_prd2_db_OLD(ADMIN)(>      DS_CER_SCORE                      numeric(10,8),
NZ_prd2_db_OLD(ADMIN)(>      US_SNR_SCORE                      numeric(10,8),
NZ_prd2_db_OLD(ADMIN)(>      US_CER_SCORE                      numeric(10,8),
NZ_prd2_db_OLD(ADMIN)(>      US_CCER_SCORE                     numeric(10,8),
NZ_prd2_db_OLD(ADMIN)(>      CM_T3_SCORE                       numeric(10,8),
NZ_prd2_db_OLD(ADMIN)(>      TOTAL_OPEN_TICKETS                integer,
NZ_prd2_db_OLD(ADMIN)(>      TOTAL_MODULATIONS_LAST_3_DAYS     integer,
NZ_prd2_db_OLD(ADMIN)(>      SUM_DURATION_MIN_PAST_3_DAYS      numeric(10,2),
NZ_prd2_db_OLD(ADMIN)(>      TOTAL_OSP_REF                     integer,
NZ_prd2_db_OLD(ADMIN)(>      TOTAL_TSG_BUS_REF                 integer,
NZ_prd2_db_OLD(ADMIN)(>      TOTAL_TSG_RES_REF                 integer,
NZ_prd2_db_OLD(ADMIN)(>      TOTAL_TROUBLE_CALLS               integer,
NZ_prd2_db_OLD(ADMIN)(>      CRITICAL                          character varying(3),
NZ_prd2_db_OLD(ADMIN)(>      DATE_STAMP                        timestamp,
NZ_prd2_db_OLD(ADMIN)(>      KOM_LAST_MODIFIED_DATE            timestamp
NZ_prd2_db_OLD(ADMIN)(> )
NZ_prd2_db_OLD(ADMIN)-> DISTRIBUTE ON RANDOM
NZ_prd2_db_OLD(ADMIN)-> ;
CREATE TABLE
NZ_prd2_db_OLD(ADMIN)=> \q
nz@<nz_server_name>:/nzscratch/test> nz_restore -db NZ_prd2_db_OLD -t NZ_table_1   -format binary -dir /nzscratch/test -thread 4

nz_restore of database NZ_prd2_db_OLD started on 2018-03-28 11:30:13

                         NZ_HOST:
                         NZ_USER: admin
                     NZ_DATABASE: NZ_prd2_db_OLD
                Backup Directory: /nzscratch/test
                   Backup Format: binary
                   Custom Script:
                    # Of Threads: 4
                Using stableTXid: 0
       The lastTXid assigned was: 0
                      Debug Mode: Disabled

=======================================================================================

Info:  table 1 of 1                                               NZ_table_1
Info:  restore process started                                    2018-03-28 11:30:13
Info:  # of bytes to be read                                      851,963,336
Info:  reloading data              ( thread 1 of 4 )
Info:  reloading data              ( thread 2 of 4 )
Info:  reloading data              ( thread 3 of 4 )
Info:  reloading data              ( thread 4 of 4 )
Info:  data flowing ...
Info:  reload finished             ( thread 3 of 4 )   seconds    38
Info:  reload results              ( thread 3 of 4 )              INSERT 0 3302193
Info:  reload finished             ( thread 4 of 4 )   seconds    38
Info:  reload results              ( thread 4 of 4 )              INSERT 0 3306067
Info:  reload finished             ( thread 2 of 4 )   seconds    41
Info:  reload finished             ( thread 1 of 4 )   seconds    41
Info:  reload results              ( thread 2 of 4 )              INSERT 0 3963680
Info:  reload results              ( thread 1 of 4 )              INSERT 0 3963043
Info:  data flow finished
Info:  restore process ended                                      2018-03-28 11:30:54
Info:  rate     (restore file size / # of seconds elapsed)        20,779,593
Info:  # of records reloaded                                      14,534,983
Info:  # of seconds elapsed                                       41

=======================================================================================

nz_restore of database NZ_prd2_db_OLD finished on 2018-03-28 11:30:54

     Total # of tables processed: 1
     Total # of records reloaded: 14,534,983
     Total # of seconds elapsed : 41

     TOTAL restore file size    : 851,963,336
     rate  (bytes per second)   : 20,779,593

=======================================================================================

nz@<nz_server_name>:/nzscratch/test> nz_find_object NZ_table_1

     The Object Name Is      | It Is Of Type | Its 'objid' Is | In The Database
-----------------------------+---------------+----------------+------------------
 NZ_table_1 | TABLE         |       18572914 | NZ_prd2_db_OLD
 NZ_table_1 | TABLE         |       18413626 | NZ_PRD1_MARCH23
(2 rows)

All about Netezza database renaming & changing owner

Here is the step by step for Netezza DB renaming & changing ownership.


SYSTEM.ADMIN(ADMIN)=> select DATABASE,OWNER,CREATEDATE from _v_database where DATABASE='NZ_PRD1_NEW';
   DATABASE   | OWNER |     CREATEDATE
--------------+-------+---------------------
 NZ_PRD1_NEW | ADMIN | 2018-03-21 18:47:00
(1 row)

SYSTEM.ADMIN(ADMIN)=> alter database NZ_PRD1_NEW rename to NZ_PRD1_NEW1;
ALTER DATABASE


SYSTEM.ADMIN(ADMIN)=> select DATABASE,OWNER,CREATEDATE from _v_database where DATABASE='NZ_PRD1_NEW1';
   DATABASE    | OWNER |     CREATEDATE
---------------+-------+---------------------
 NZ_PRD1_NEW1 | ADMIN | 2018-03-21 18:47:00
(1 row)


SYSTEM.ADMIN(ADMIN)=> alter database NZ_PRD1_NEW1  owner to admin;
ALTER DATABASE

SYSTEM.ADMIN(ADMIN)=> select DATABASE,OWNER,CREATEDATE from _v_database where DATABASE='NZ_PRD1_NEW1';
   DATABASE    |  OWNER  |     CREATEDATE
---------------+---------+---------------------
 NZ_PRD1_NEW1 | ADMIN | 2018-03-21 18:47:00
(1 row)

SYSTEM.ADMIN(ADMIN)=> drop database NZ_PRD1_NEW1;
DROP DATABASE
SYSTEM.ADMIN(ADMIN)=> select DATABASE,OWNER,CREATEDATE from _v_database where DATABASE='NZ_PRD1_NEW1';
 DATABASE | OWNER | CREATEDATE
----------+-------+------------

(0 rows)

Friday, March 16, 2018

Netezza error when trying to change DB name


ISSUE:
when I tried to change the Netezza DB name,it throws the below error and did not allow to rename.

SYSTEM(ADMIN)=> alter database NZDB1 rename to NZDB1_old;
ERROR:  ALTER DATABASE: database "NZDB1" is being accessed by other users
SYSTEM(ADMIN)=> \q
nz@NZ_server_name:/export/home/nz> nzsession

ID    Type     User      Start Time              PID   Database State  Priority Name Client IP      Client PID Command
----- -------- --------- ----------------------- ----- -------- ------ ------------- -------------- ---------- ------------------------
62849 sql-odbc NZUSER 02-Mar-18, 03:45:18 EST 14040 NZDB1 idle   normal        10.128.211.171       7716 SHOW ENABLE_ROW_SECURITY
92451 sql      ADMIN     15-Mar-18, 16:01:35 EDT  6134 SYSTEM   active normal             127.0.0.1       6133 SELECT session_id, clien


Solution:
checked the session associated with DB  and cleared it and rename the DB ,it went fine.

nz@NZ_server_name:/export/home/nz> nzsession abort -id 62849 -force
nz@NZ_server_name:/export/home/nz> nzsession

ID    Type User  Start Time              PID   Database State  Priority Name Client IP Client PID Command
----- ---- ----- ----------------------- ----- -------- ------ ------------- --------- ---------- ------------------------
92454 sql  ADMIN 15-Mar-18, 16:02:36 EDT 10149 SYSTEM   active normal        127.0.0.1      10148 SELECT session_id, clien

nz@NZ_server_name:/export/home/nz> 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)=> alter database NZDB1 rename to NZDB1_old;
ALTER DATABASE
SYSTEM(ADMIN)=>  alter database NZDB1_NEW rename to NZDB1;
ALTER DATABASE
SYSTEM(ADMIN)=> \l
           List of databases
           DATABASE           |  OWNER
------------------------------+---------
 NZDB1                        | ADMIN
 NZDB1_OLD                    | ADMIN

Thursday, March 15, 2018

oracle database error during DB startup


Issue:
I have faced some issue  & DB did not open when I restart the database using Pfile  and got the below error.

SQL> startup pfile='initORA1.ora' mount;
ORACLE instance started.

Total System Global Area 2.5655E+10 bytes
Fixed Size                  2258352 bytes
Variable Size            2617248336 bytes
Database Buffers         2.3018E+10 bytes
Redo Buffers               16904192 bytes
ORA-00201: control file version 11.2.0.4.0 incompatible with ORACLE version
11.1.0.0.0
ORA-00202: control file: '/appdb1/oradata/oradb1.redoctrl01/control01.ctl'

Cause:
looks like the compatible  parameter value different in P & SP file

Solution:
corrected the Pfile according to SP file compatible value  and restarted the database and it opened without any issues.

oracle database memory upgrade error

when I tried to increase the sga_max_size and sga_target and got  the below error.


ISSUE:

alter system set SGA_MAX_SIZE=12288M scope=spfile;

 alter system set SGA_TARGET=12G scope=spfile;


SQL> startup pfile='initOra1.ora' mount;
ORA-00844: Parameter not taking MEMORY_TARGET into account
ORA-00851: SGA_MAX_SIZE 12884901888 cannot be set to more than MEMORY_TARGET 9663676416.
ORA-01078: failure in processing system parameters

Cause:
when I checked the parameter file and it contains AMM parameter enabled.

Solution:
remove  or comment the memory_target from the parameter file and startup with pfile  with sga_max_size & sga_target.

Tuesday, March 13, 2018

How to find locks on Netezza database?

Here is the step by step to find  the blocking or locking session in Netezza database
Please get the SQL statement  that's running on the server and get the table that you have issue and check locking session with the  DB  name and table name

nz_show_locks  NZ_DB1 table_name1



 Database: NZ_DB1

   Object: table_name1

 ObjectId: 13231729

Timestamp: 2018-03-01 17:12:49



=======================================================================================================



The following session(s) are HOLD'ing a lock on the object



 Requested | Granted @ | Wait Time | SESSIONID | PROCESSID | USERNAME  |    LOCKMODE     |           Current SQL Command

-----------+-----------+-----------+-----------+-----------+-----------+-----------------+------------------------------------------

 15:21:05  | 15:21:05  | 00:00:00  |    448002 |     14511 | user1 | AccessShareLock | SELECT count(a11.CHC_ID),a11.day_id, DEC

 16:01:12  | 16:01:12  | 00:00:00  |    448260 |      3201 | user1 | AccessShareLock | SELECT count(a11.CHC_ID),a11.day_id, DEC

 16:11:40  | 16:11:40  | 00:00:00  |    448329 |      1450 | user1 | AccessShareLock | SELECT count(a11.CHC_ID),a11.day_id, DEC

 16:51:37  | 16:51:37  | 00:00:00  |    448632 |     20697 | USR2  | AccessShareLock | SELECT MAX (a13.MONTH_DESC) MONTH_AT_DIS

(4 rows)



=======================================================================================================



The following sessions are WAIT'ing to access the object



 Requested | Granted @ | Wait Time | SESSIONID | PROCESSID |  USERNAME  |      LOCKMODE       |           Current SQL Command

-----------+-----------+-----------+-----------+-----------+------------+---------------------+------------------------------------------

 16:54:35  |           | 00:18:15  |    448653 |     30742 | USER4     | AccessExclusiveLock | ALTER TABLE NZ_DB1.NZUSER.TABLE_NAME

 16:55:27  |           | 00:17:23  |    448679 |      2638 |   USR5    | AccessShareLock     | SELECT To_Date (a.WFINDATE_DAY_ID, 'yyyy

 16:56:55  |           | 00:15:55  |    448680 |      4580 | USER3     | AccessShareLock     | select a13.MONTH_ID MONTH_ID1, max(a13.m

 16:57:48  |           | 00:15:02  |    448623 |     18626 | USER3     | AccessShareLock     | CREATE TEMP TABLE T6GXA4WPZMD003 as sele

 16:58:53  |           | 00:13:57  |    448624 |     18625 | USER3     | AccessShareLock     | CREATE TEMP TABLE TJCDUKW1BMD004 as sele

(5 rows)



=======================================================================================================

Monday, March 12, 2018

How to take backup of users  only in Netezza database?

Please use the below command to take user only backup.it will create a folder .
/SYSTEM/20180312164028/1/USERS/md


/nz/kit/bin/nzbackup -users -dir /export/home/nz/ > user_backup.log


Backup of global objects completed successfully.