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

Troubleshooting Guide: SQL Server Error 3036 — Database in Warm-Standby State

Why This Error Happens

This error occurs because the database was restored using the RESTORE ... WITH STANDBY option, which places it in a read-only, warm-standby state while keeping it ready to accept additional transaction log restores. SQL Server blocks backup operations on a standby database because the restore sequence is technically still “open” — the transaction log chain has not been finalized with a RECOVERY operation. Attempting to back up a database mid-restore-sequence would create an inconsistent or unusable backup, so SQL Server intentionally raises Error 3036 to prevent this.

Step-by-Step Resolution Guide

Step 1: Confirm the Database State

  • Open SQL Server Management Studio (SSMS) or run a query against sys.databases to check the current state.
  • Execute: SELECT name, state_desc FROM sys.databases WHERE name = 'YourDatabaseName';
  • Look for STANDBY in the state_desc column to confirm this is the root cause.

Step 2: Determine Whether the Restore Sequence Is Complete

  • Check if there are remaining transaction log backups that still need to be applied.
  • Review your log shipping or restore script to see if more RESTORE LOG ... WITH STANDBY or WITH NORECOVERY statements are pending.
  • If part of log shipping, verify the monitor job history in msdb.dbo.log_shipping_monitor_history_detail.

Step 3: Finish the Restore Sequence or Recover the Database

  • If all required log backups have been applied, run the final recovery command to close out the restore sequence:
  • RESTORE DATABASE YourDatabaseName WITH RECOVERY;
  • If you need to continue restoring more logs first, apply them with WITH STANDBY or WITH NORECOVERY before the final recovery step.
  • Avoid running a backup job (via SQL Agent or scripts) until this recovery step has fully completed.

Step 4: Adjust Backup Jobs or Automation Scripts

  • Update any SQL Server Agent jobs or scripts (e.g., PowerShell, dbatools) that attempt to back up this database to run only after recovery completes.
  • Navigate to SQL Server Agent > Jobs in SSMS on Windows Server 2025 and edit the job step that triggers the backup.
  • Add a conditional check using DATABASEPROPERTYEX('YourDatabaseName', 'Status') to ensure the database is ONLINE before proceeding.

Step 5: Re-Attempt the Backup Operation

  • Once the database shows ONLINE instead of STANDBY/RESTORING, retry your backup command.
  • Execute: BACKUP DATABASE YourDatabaseName TO DISK = 'C:\Backups\YourDatabaseName.bak';
  • Confirm the job completes without Error 3036 appearing in the SQL Server Error Log.

Alternative or Verification Steps

  • Verify the fix by re-running SELECT state_desc FROM sys.databases WHERE name = 'YourDatabaseName'; and confirming the result reads ONLINE.
  • If the database must remain in standby for ongoing log shipping, consider backing up from the primary server instead, since standby/secondary databases in this configuration are not meant to be backed up directly until the restore chain is manually broken with RESTORE WITH RECOVERY.