Abort Sessions and List status of Abort Session in Teradata

There is two function ABORTSESSIONS and ABORTLISTSESSIONS that we can use to abort session and list status of abort session.

Abort Session:

REPLACE FUNCTION SYSLIB.ABORTSESSIONS

(HostIdIn SMALLINT,

UserNameIn TD_ANYTYPE,

SessionNoIn INTEGER,

LogoffSessions VARCHAR(1) CHARACTER SET LATIN,

UserOverride VARCHAR(1) CHARACTER SET LATIN)

RETURNS INTEGER

SPECIFIC AbortSessions

LANGUAGE C

NO SQL

NO EXTERNAL DATA

PARAMETER STYLE SQL

NOT DETERMINISTIC

CALLED ON NULL INPUT

EXTERNAL NAME 'SL!api!F!AbortSessions_U';

Input Parameters

Example:

Abort all session for user

SELECT AbortSessions (1, '<USERNAME>', 0, 'N', 'N');

Abort single session for a user

SELECT AbortSessions (1, '<USERNAME>', <SESSION_NUMBER>, 'N', 'N');

List status of Abort Session

REPLACE FUNCTION SYSLIB.ABORTLISTSESSIONS

(HostIdIn SMALLINT,

UserNameIn TD_ANYTYPE,

SessionNoIn INTEGER,

LogoffSessions VARCHAR(1) CHARACTER SET LATIN,

UserOverride VARCHAR(1) CHARACTER SET LATIN)

RETURNS TABLE

(HostId SMALLINT,

SessionNo INTEGER,

UserName VARCHAR(128) CHARACTER SET UNICODE,

AbortStatus CHAR(1) CHARACTER SET LATIN)

SPECIFIC AbortListSessions

LANGUAGE C

NO SQL

NO EXTERNAL DATA

PARAMETER STYLE SQL

NOT DETERMINISTIC

CALLED ON NULL INPUT

EXTERNAL NAME 'SL!api!F!AbortListSessions_U';

Input Parameters

SELECT * FROM TABLE (AbortListSessions(1, 'User1', 0, 'Y', 'Y')) AS t1;

*** Query completed. 5 rows found. 4 columns returned.

*** Total elapsed time was 4 seconds.

HostId SessionNo UserName AbortStatus

------ ----------- ----------- -----------

1 1007 USER1

1 1011 USER1

1 1010 USER1

1 1009 USER1

1 1008 USER1

Please visit to know how to kill user or session by using Teradata Global Utility (gtwglobal)