Troubleshooting Guide: SQL Server Error 678 – Active Rowset for Partition ID Found at End of Batch
Why This Error Happens
This error occurs when SQL Server’s storage engine detects that an internal rowset associated with a specific partition ID was left active after a batch of operations completed, which typically points to improper exception handling during a transaction or bulk operation. It commonly surfaces during large index rebuilds, partition switching, or parallel query execution where a session was interrupted (via timeout, network failure, or manual cancellation) without allowing the engine to properly clean up its internal cursors. In some cases, this is also a symptom of underlying corruption in the partitioned table’s metadata or an incompatible driver/client library mishandling connection resets.
Step-by-Step Resolution Guide
Step 1: Identify the Offending Session and Terminate It
- Open SQL Server Management Studio (SSMS) and navigate to Management > Activity Monitor.
- Locate the Session ID (SPID) referenced in the error log tied to the partition operation.
- Run the following to confirm the process is still active:
SELECT session_id, status, last_request_start_time, blocking_session_id
FROM sys.dm_exec_requests
WHERE session_id = <SPID>;
- If confirmed hung or orphaned, terminate it using:
KILL <SPID>;
Step 2: Check for Partition-Level Corruption
- Run
DBCC CHECKTABLEagainst the affected table to rule out index/partition corruption:
DBCC CHECKTABLE ('YourTableName') WITH ALL_ERRORMSGS, NO_INFOMSGS;
- Review the SQL Server error log (default path:
C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Log\ERRORLOG) for accompanying corruption warnings (Error 823, 824, or 5180). - If corruption is found, restore the affected partition from the last known good backup.
Step 3: Update SQL Server Cumulative Updates and Drivers
- Confirm your instance is on the latest Cumulative Update (CU) for SQL Server 2025 via SSMS > Help > About.
- Download and apply the latest CU from the official Microsoft Update Catalog.
- On the client side, ensure the ODBC Driver or OLE DB Driver used by the application connecting to SQL Server is updated to the latest version compatible with Windows Server 2025 / Windows 11.
- Restart the SQL Server service after patching:
Restart-Service -Name MSSQLSERVER -Force
Step 4: Review and Adjust Query Timeout / Batch Settings
- If the error correlates with long-running batch jobs, increase the command timeout setting in your application’s connection string (e.g.,
Connection Timeout=60or higher). - For SSIS or scheduled jobs, edit the timeout property in SQL Server Agent > Job Steps > Advanced to allow sufficient completion time before forced termination.
Alternative or Verification Steps
- Verify the fix: Re-run the original batch/partition operation and monitor
sys.dm_exec_requestsand the SQL Server error log to confirm Error 678 no longer appears. - Alternative solution: If the issue persists after patching and session cleanup, rebuild the affected partitioned index entirely using
ALTER INDEX ... REBUILD PARTITION = ALLto force SQL Server to regenerate clean rowset metadata.