How to kill a session using SQL
Posted in 2018
Topics: General Discussion
Need assistance. From an Administrator SQL session need to kill client database sessions that meet certain criteria. Can do this in SQL Server and Oracle. Need a SQL command that can kill a session based upon the client IP address and port no. In reviewing the sysmaster tables/views I see the view where the client session's host IP address is. However cannot locate the port no. for the client session. Thanks in advance for any helpful information.
Joseph,
practically all the commands onmode onstat etc .. .can be executed thru the
SQL Admin API.
check here
https://www.ibm.com/support/knowledgecenter/en/SSGU8G_12.1.0/com.ibm.adref.doc/i
ds_sapi_094.htm
in your case you will to to do the following
dbaccess (or whatever) sysadmin;
EXECUTE FUNCTION task("onmode","z","14");14 is the number of the session you wanna kill
Hope this helps
Eric
Thank you. This is great. Question. Want to query the client port no. for a database session. Are you aware of what sysmaster table/view this would be in?
Just curious: why do you wanna query the session port # ? I do not think this info is in sysmaster, but depending on your client (CSDK, 4gl, Java), you will find the info associated with the value of the INFORMIXSERVER variable, either in the $INFORMIXDIR/etc/sqlhosts file (unix) or in the setnet32 utility(windows) or in the connect string for java. And if you don't have the port number, you cannot connect to the DB, thus you can't query it :-)