|
|
Archives of the TeradataForum
Message Posted: Tue, 22 Nov 2011 @ 08:27:26 GMT
Subj: | | Re: How to abort a session from a batch program ? |
|
From: | | sivaji.gv |
In TD12, you can use SYSLIB.AbortSessions() function to abort the selective session based on hostid, username and sessionno.
Also you can get the hostid, username and sessionno from table function MonitorSession(-1,'*',0) function.
Eg:
/* redirect below output to an sql file and run this through bteq */
/* Abort sessions selectively for a user */ SEL 'SELECT SYSLIB.AbortSessions(' ||
TRIM(A.Hostid)||','||''''||TRIM(A.UserName) || '''' ||','|| CAST(A.SessionNo AS FLOAT
FORMAT'zzzzz9999') || ','||''''|| 'Y' || ''''
||','|| ''''|| 'N' || '''' || ');' (TITLE '')
FROM (
SELECT hostid,username ,sessionNo
FROM
TABLE (MonitorSession(-1,'*',0)) AS t2
WHERE username='SYSDBA11' AND logontime <= '2011/11/19 00:00:00.00'
) A ORDER BY username;
Regards
Sivaji GV
DWSDBA
| |