Terminate (kill) specific session on a server

Teradata provides function to abort specific session on a server.

Find active sessions

First we will identify the session we want to end. We do it by listing all sessions on the server with this query:

SELECT  *
FROM    DBC.SessionInfoV;

Result

Result shows active sessions on server.

sample results

Kill session

AbortSessions function

AbortSessions( HostIdIn, UserNameIn, SessionNoIn, LogoffSessions, UserOverride )

  • HostIdIn - ID of a host (or client) with sessions logged on. Value -1 indicate all hosts
  • UserNameIn - user name of the session. Null or '*' for all users
  • SessionNoIn - ID of the session to abort. 0 indicate all of them
  • LogoffSessions - Indicator of whether to log off sessions to Teradata Database in addition to aborting them:
    • 'Y' - Log off and abort sessions.
    • 'N' or null - Do not log sessions off.
  • UserOverride - Indicator of whether to override an ABORT SESSION failure:
    • 'Y' - Override the ABORT SESSION request to fail
    • 'N' or null - Do not override

Terminate session only by session id

We will use session ID to kill the session (1018 in our example):

SELECT SYSLIB.AbortSessions (-1, null, 1018, 'Y', 'Y');

Terminate all sessions of specific user

SELECT SYSLIB.AbortSessions (-1, 'DAE', 0, 'Y', 'Y');

Result

Query return number of sessions aborted.

sample results

Comments are only visible when the visitor has consented to statistics cookies. To see and add comments please accept statistics cookies.
0
There are no comments. Click here to write the first comment.