nzsession Command: How to Manage Netezza Sessions

  • Post author:
  • Post last modified:February 28, 2018
  • Post category:Netezza
  • Reading time:5 mins read

A Netezza session represents a single connection to the Netezza appliance. You can use the nzsession command to view and manage the sessions.

nzsession command

Session starts when user performs following things:

  • Run nzsql command and session ends when they exit
  • Run nzload command
  • Use nzadmin tool
  • Connect to Netezza system with JDBC, ODBC or OLEDB drivers. The session ends when command completes

You must be the system administrator or should have proper permissions to show and manage the sessions and transactions.

Read:

View Session using nzsession command

You can use the nzsession command to view the list of current user sessions and its types. You must be a Netezza administrator or the user of database to view and manage sessions with nzsession show command. However, output of nzsession seems to be unclear if you do not have the required privileges. By default, admin can view and manage all system and user sessions.

To view sessions follow below steps:

Execute below command on the Netezza server tp check the active sessions:

nzsession show -u admin -pw password

If you are a database user without special privileges, information like user name, database name, client PID, and SQL query display as asterisks.

nzsession command input options

Input Description
nzsession abort options Abort a running user session.
nzsession abortTxn options Abort a user transaction.
nzsession listSessionTypes Lists the session types
nzsession priority options Changes priority of the current and all subsequent jobs of this session.
nzsession show options Displays the list of current user sessions.

Where Options includes:

Command Options Description
All nzsession commands -u user Specifies the database user name [NZ_USER].
-pw password Specifies the user password [NZ_PASSWORD].
-host name Specifies host name or IP address [NZ_HOST]. Except listSessionTypes.
nzsession abort, and abortTxn -id num Specifies the session ID.
-force Does not prompt for confirmation.
nzsession priority -id num Specifies the session ID.
-high Changes the session priority to high.
-normal Changes the session priority to normal.
-low Changes the session priority to low.
-critical Changes the session priority to critical.
nzsession show -activeTxn Displays the active transactions for the system.
-maxColW chars Specifies the maximum number of characters to print in a column. The default is 24.

Command to Kill or Abort Netezza Sessions

You can use the nzsession command to abort sessions or transactions. You can abort a transaction if you are the admin, the owner of the session, or you have Abort privileges.

You can abort SQL, client, load, backup, and restore sessions. Keep in the mind that, do not abort the system sessions, system may crash to restart.

Abort transactions:

nzsession abortTxn -u admin -pw password -id 31334

Abort netezza session:

nzsession abort -u user -pw password -host nzhost -id 1344

Change the priority of Netezza sessions:

nzsession priority -u user -pw password -host nzhost -id 437 -high

Display active transactions:

nzsession show -activeTxn