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

Troubleshooting Guide: SQL Server Error 3031

Why This Error Happens

Error 3031 occurs when a BACKUP or RESTORE statement contains two or more WITH options that are logically incompatible with one another, such as combining DIFFERENTIAL with COPY_ONLY, or specifying both STANDBY and RECOVERY in the same command. SQL Server’s parser validates option compatibility before execution, and when it detects conflicting flags, it halts the statement rather than guessing which option takes precedence. This is almost always caused by a manually written or auto-generated T-SQL script (often from older maintenance plans or third-party backup tools) that hasn’t been updated for SQL Server 2025 syntax rules.

Step-by-Step Resolution Guide

Step 1: Identify the Conflicting Options in the Statement

  • Open the exact T-SQL command that triggered the error from SQL Server Management Studio (SSMS) or the application log.
  • Look closely at the error message text — it explicitly names both options, e.g., Option 'DIFFERENTIAL' conflicts with option(s) 'COPY_ONLY'.
  • Common conflicting pairs include: NORECOVERY + STANDBY, DIFFERENTIAL + COPY_ONLY, and CONTINUE_AFTER_ERROR + CHECKSUM in certain restore scenarios.

Step 2: Edit the Script to Remove the Incompatible Clause

  • Open the script file (commonly located in C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Backup\ or a custom job step in SQL Server Agent).
  • Delete or comment out one of the two conflicting WITH options based on your actual intent (e.g., keep DIFFERENTIAL if you need an incremental backup, and remove COPY_ONLY).
  • Save the corrected script and re-run it manually in a new SSMS query window before re-enabling any scheduled job.

Step 3: Check Maintenance Plans and Agent Jobs for Legacy Syntax

  • Navigate to SQL Server Agent > Jobs in SSMS and review any backup/restore job steps generated by Maintenance Plan Wizards.
  • Regenerate the maintenance plan using the SQL Server 2025 wizard if it was migrated from an older version (2016/2019), since deprecated option combinations may have carried over.
  • Confirm third-party backup software (e.g., Veeam, Redgate) is updated to a version certified for SQL Server 2025 compatibility.

Step 4: Validate Permissions and Re-execute

  • Ensure the executing account has BACKUP DATABASE or BACKUP LOG permission via Security > Logins in SSMS, since permission errors can sometimes surface alongside syntax issues in chained scripts.
  • Re-run the corrected statement directly against the target database to confirm the conflict is resolved.

Alternative or Verification Steps

  • Run the corrected BACKUP/RESTORE command manually in SSMS and confirm it completes with “100 percent processed” and no error 3031 in the Messages tab.
  • If the error persists, use RESTORE HEADERONLY or RESTORE FILELISTONLY against the backup file to inspect its existing option metadata, which can reveal hidden option conflicts from the original backup operation.