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)
=======================================================================================================
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)
=======================================================================================================
No comments:
Post a Comment