Why This Error Happens
SQL Server Error 3023 occurs because backup, restore, and file manipulation operations (such as ALTER DATABASE ADD FILE or DBCC commands) must be serialized against a single database. This error is triggered when a second session attempts to run a conflicting operation—like a backup—while another backup, restore, or file-structure change is already in progress on the same database. Essentially, SQL Server locks the database at an internal level to prevent concurrent structural changes, and any overlapping request is rejected rather than queued.
Step-by-Step Resolution Guide
Step 1: Identify Concurrent or Stuck Sessions
- Open SQL Server Management Studio (SSMS) and connect to the instance reporting the error.
- Run the following query to check for active backup/restore operations:
SELECT r.session_id, r.command, r.percent_complete, r.start_time, t.text
FROM sys.dm_exec_requests r
CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) t
WHERE r.command LIKE '%BACKUP%' OR r.command LIKE '%RESTORE%';
- Note the
session_idof any long-running or orphaned backup task.
Step 2: Terminate Blocking or Orphaned Processes
- If a session is confirmed stuck (not progressing in
percent_completeover several minutes), terminate it safely:
KILL <session_id>;
- Avoid killing active, progressing backups—only terminate sessions confirmed as hung or orphaned.
- Check the SQL Server Error Log (via SSMS > Management > SQL Server Logs) for any prior failed backup jobs that may not have released their lock.
Step 3: Verify Backup Job Scheduling Conflicts
- Open SQL Server Agent and review all backup-related Jobs under
SQL Server Agent > Jobs. - Ensure no two jobs (e.g., a full backup and a transaction log backup) are scheduled to run simultaneously on the same database.
- Stagger job schedules by at least 15-30 minutes to prevent overlap, especially for large databases on Windows Server 2025.
Step 4: Check for File-Level Locks on Windows Server 2025
- Navigate to the backup destination path (e.g.,
D:\SQLBackups\) and confirm no antivirus or Windows Defender real-time scanning is locking the.bakor.trnfiles. - Add an exclusion rule in Windows Security settings for the SQL Server data and backup directories:
C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\- Your custom backup directory.
Step 5: Restart SQL Server Service (If Issue Persists)
- If the lock state remains stuck, restart the SQL Server service via Services.msc or:
Restart-Service -Name 'MSSQLSERVER' -Force
- This clears any internal serialization locks that failed to release properly.
Alternative or Verification Steps
- Re-run the original backup command after completing the steps above; confirm it completes without Error 3023 and check
msdb.dbo.backupsetto verify the backup entry was logged successfully. - If the error persists, use
sp_who2to cross-verify no hidden system processes (like Always On availability group synchronization) are holding a serialization lock on the database.