Use the KILL command to terminate an active user session on your ApsaraDB RDS for SQL Server instance. This is useful when a session is idle, blocking other queries, or consuming excessive resources.
Prerequisites
Before you begin, ensure that you have:
An ApsaraDB RDS for SQL Server instance running SQL Server 2012 or later
Limitations
You can only close connections that you initiated. You cannot close other connections, such as backup connections.
Close a connection
Query
sys.dm_exec_sessionsto list active user sessions and identify the Process ID to terminate:SELECT session_id, login_name, status FROM sys.dm_exec_sessions WHERE is_user_process = 1The
session_idcolumn contains the Process ID you need for theKILLcommand.Run
KILLwith thesession_idfrom the query above:KILL <Process ID>For example, to terminate session 53:
KILL 53
该文章对您有帮助吗?