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

Troubleshooting Guide: SQL Server Error 4030 – Media Expiration Conflict

Why This Error Happens

This error occurs because SQL Server enforces a retention policy on backup media through the MEDIADESCRIPTION and expiration date metadata written to the backup header. When a backup device (tape or disk file) has an active expiration date set via EXPIREDATE or RETAINDAYS, SQL Server blocks any new BACKUP operation from overwriting that media until the specified date has passed. This is a protective mechanism, not a corruption issue, and most commonly happens when backup jobs reuse the same device name without accounting for retention settings, or when a FORMAT option was omitted on a backup set that still has life remaining.

Step-by-Step Resolution Guide

Step 1: Verify the Current Expiration Date on the Media

  • Open SQL Server Management Studio (SSMS) and connect to the instance via a new query window.
  • Run the following to inspect the backup set metadata:
RESTORE HEADERONLY FROM DISK = 'E:\Backups\YourFile.bak';
  • Check the ExpirationDate column in the result set to confirm whether the media is still within its retention window.

Step 2: Force an Overwrite Using the WITH Clause

  • If the backup content is no longer needed, explicitly override the expiration check in your backup script.
  • Use WITH FORMAT, INIT, SKIP to bypass expiration and retention checks on the next write:
BACKUP DATABASE [YourDB]
TO DISK = 'E:\Backups\YourFile.bak'
WITH FORMAT, INIT, SKIP, STATS = 10;
  • The SKIP option specifically disables the expiration date and backup set name checks that trigger Error 4030.

Step 3: Correct the Retention Settings in the Maintenance Plan

  • Open SQL Server Agent in SSMS and locate the relevant Maintenance Plan under Management > Maintenance Plans.
  • Edit the Back Up Database Task and check the Backup set will expire setting; adjust RETAINDAYS to 0 if indefinite overwrites are intended, or set a realistic value matching your retention policy.
  • Save and redeploy the plan, then manually trigger the job via SQL Server Agent > Jobs to confirm it executes without raising 4030.

Step 4: Check for Group Policy or File-Level Immutability (Windows Server 2025 / Windows 11)

  • Navigate to the backup folder (e.g., E:\Backups\) in File Explorer and right-click the .bak file to open Properties > Security.
  • Confirm the SQL Server service account has Modify/Write permissions, as Windows Server 2025’s stricter default ACLs can sometimes compound perceived “locked” media issues alongside the SQL-level expiration flag.
  • Run icacls "E:\Backups\YourFile.bak" from an elevated Command Prompt to audit permissions if the file was moved or restored from another system.

Alternative or Verification Steps

  • Re-run RESTORE HEADERONLY FROM DISK = 'E:\Backups\YourFile.bak'; after the fix — if the query returns without error and shows the new BackupStartDate, the overwrite succeeded.
  • As an alternative, bypass the existing media entirely by targeting a new file name or device (e.g., YourFile_New.bak) to avoid the expiration conflict without altering retention logic.