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, andCONTINUE_AFTER_ERROR+CHECKSUMin 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
DIFFERENTIALif you need an incremental backup, and removeCOPY_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 DATABASEorBACKUP LOGpermission 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/RESTOREcommand 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 HEADERONLYorRESTORE FILELISTONLYagainst the backup file to inspect its existing option metadata, which can reveal hidden option conflicts from the original backup operation.