How to fix Error 3980 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3980

Why This Error Happens

Error 3980 (“The request failed to run because the batch is aborted”) typically occurs during backup or restore operations within a transaction when a prior statement in the same batch encounters a fatal error, forcing SQL Server to terminate the entire batch. This is commonly triggered by marked transactions (WITH MARK) failing due to insufficient log space, a corrupted backup chain, or conflicting session states. It can also surface when permissions are revoked mid-transaction or when the backup/restore target file is locked or unreachable, causing SQL Server to abort rather than risk data inconsistency.

Step-by-Step Resolution Guide

Step 1: Verify the Transaction Log and Disk Space

  • Check available disk space on the drive hosting your .ldf log file and backup destination.
  • Run DBCC SQLPERF(LOGSPACE); to confirm the transaction log isn’t full.
  • If space is low, expand the log file via SQL Server Management Studio (SSMS) > Database Properties > Files, or run:
  ALTER DATABASE [YourDB] MODIFY FILE (NAME = YourDB_log, SIZE = 5GB);

Step 2: Check for Blocking Sessions or Orphaned Transactions

  • Run DBCC OPENTRAN('YourDB'); to identify long-running or orphaned transactions.
  • Use sp_who2 or query sys.dm_exec_requests to locate blocking session IDs (SPIDs).
  • Kill any stuck sessions causing the abort with KILL <SPID>; if safe to do so.

Step 3: Validate Backup/Restore File Integrity and Permissions

  • Confirm the SQL Server service account has read/write access to the backup folder path (e.g., D:\SQLBackups\).
  • Right-click the folder > Properties > Security tab, and ensure NT SERVICE\MSSQLSERVER has Full Control.
  • Run RESTORE VERIFYONLY FROM DISK = 'D:\SQLBackups\YourDB.bak'; to check for corruption.

Step 4: Review SQL Server Error Logs for Root Cause

  • Open SSMS > Management > SQL Server Logs, or navigate to:
    C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG
  • Search for the preceding error (e.g., Error 9002, 3041, or 5172) that triggered the 3980 abort.
  • Address the root error first, as 3980 is usually a secondary symptom.

Step 5: Rebuild the Transaction Using Isolated Batches

  • Break large multi-statement transactions into smaller, isolated batches separated by GO.
  • Re-run the operation using SET XACT_ABORT ON; at the start of the script to ensure cleaner rollback behavior on failure.

Alternative or Verification Steps

  • Verify the fix: Re-run the original backup/restore command and confirm it completes with “Processed X pages” success messages instead of aborting.
  • Alternative: If the issue persists on Windows Server 2025, run DBCC CHECKDB('YourDB') WITH NO_INFOMSGS; to rule out underlying database corruption as the root trigger.