Why This Error Happens
Error 6115 is raised when a KILL statement runs inside an open user transaction, which SQL Server does not allow. The most likely cause is that the session issuing KILL has an uncommitted BEGIN TRAN block, or a script, stored procedure, or application wraps the command in a transaction. Permissions, port conflicts, and file corruption are less likely causes for this specific symptom and should be ruled out only if the steps below do not resolve it.
Step-by-Step Resolution Guide
Step 1: Identify the Open Transaction
- Connect to SQL Server Management Studio (SSMS) on Windows 11 or Windows Server 2025 and open a new query window against the instance that returned error 6115.
- Run
SELECT @@TRANCOUNT;in the same session where you attempted theKILLcommand to confirm an open transaction exists (a value greater than 0 confirms it). - Optionally, run
DBCC OPENTRAN;or querysys.dm_tran_session_transactionsjoined tosys.dm_exec_sessionsto review open transactions across all sessions on the instance.
Step 2: End the Open Transaction
- In the session that holds the transaction, run
COMMIT TRANSACTION;to save the pending work, orROLLBACK TRANSACTION;to discard it, depending on whether the changes should be kept. - Re-run
SELECT @@TRANCOUNT;and confirm the result returns0before continuing.
Step 3: Run KILL in Its Own Batch
- Open a new query window in SSMS that has no active
BEGIN TRAN/COMMIT/ROLLBACKblock. - Execute
KILL <session_id>;(for example,KILL 55;), replacing<session_id>with the actual SPID of the target session, which you can confirm first withSELECT session_id, status, login_name FROM sys.dm_exec_sessions WHERE session_id = <session_id>;.
Step 4: Update Scripts or Application Code That Wrap KILL in a Transaction
- Locate the source of the command — this is typically a maintenance script, a stored procedure, or a SQL Server Agent job step. In SSMS, check Object Explorer > SQL Server Agent > Jobs > [Job Name] > Steps to view the exact T-SQL being executed, or open the corresponding
.sqlfile if the script is stored externally (for example,C:\Scripts\Maintenance\KillSession.sql). - Move the
KILL <session_id>;statement so it sits outside anyBEGIN TRAN/COMMIT/ROLLBACKblock in the script or stored procedure, then save the change and re-run the job or script to confirm the fix.
Step 5: Confirm the Executing Login Has the Required Permission
- Verify that the login running the command holds the ALTER ANY CONNECTION permission on the server, or is a member of the fixed server role processadmin (or sysadmin). You can check this by running
SELECT * FROM sys.fn_my_permissions(NULL, 'SERVER') WHERE permission_name = 'ALTER ANY CONNECTION';while logged in as the affected user. - Grant the permission only if the earlier steps did not resolve the error, using
GRANT ALTER ANY CONNECTION TO [LoginName];in a query window.
Alternative or Verification Steps
- Verify the fix: Run
SELECT session_id FROM sys.dm_exec_sessions WHERE session_id = <session_id>;to confirm the target session no longer appears, and confirm that theKILLcommand completes without raising error 6115. - Alternative if the error persists: Review the SQL Server error log at
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG(adjust the instance folder name if using a named instance) or the relevant application/service logs to trace any code path that opens a transaction before callingKILL, and refactor that path so the command always executes outside the transaction scope.