Troubleshooting Guide: SQL Server Error 3247 – Wrong Media Sequence Number
Why This Error Happens
Error 3247 occurs when SQL Server 2025 is performing a restore operation from a multi-volume backup set and detects that the media volume currently loaded does not match the expected sequence number in the backup header. This typically happens when backup tapes, files, or disk volumes belonging to a striped or multi-file backup set are presented to the RESTORE command out of order. It can also occur if a backup file was manually renamed, partially copied, or corrupted, causing SQL Server’s media management subsystem to misread the volume’s internal sequence metadata.
Step-by-Step Resolution Guide
Step 1: Identify the Correct Volume Order
- Run
RESTORE LABELONLY FROM DISK = 'path_to_backup'orRESTORE HEADERONLYagainst each file in the backup set to inspect theMediaSequenceNumberandFamilySequenceNumbercolumns. - Record the correct numerical order of each
.bakor.trnfile as indicated by SQL Server metadata, not by filename or timestamp. - On Windows Server 2025/Windows 11, ensure all volume files are accessible from the same local path or UNC share (e.g.,
\\BackupServer\SQLBackups\).
Step 2: Reissue the RESTORE Command in Correct Sequence
- Use the
RESTORE DATABASE ... FROM DISK = N'Volume1', DISK = N'Volume2'syntax, explicitly listing files in the sequence number order identified in Step 1. - If using a media/tape library, physically reload the volumes in the exact order requested by the error message prompt (e.g., “insert volume 2”).
- Example T-SQL:
RESTORE DATABASE [YourDB]
FROM DISK = N'C:\Backups\Backup_Vol1.bak',
DISK = N'C:\Backups\Backup_Vol2.bak'
WITH FILE = 1, NORECOVERY;
Step 3: Validate Backup File Integrity
- Run
RESTORE VERIFYONLY FROM DISK = 'path_to_backup'on each volume to confirm the file is not corrupted or truncated. - Check file properties in Windows File Explorer or via PowerShell (
Get-Item <path> | Select Length) to ensure no volume was partially copied during a file transfer. - If a volume is missing or corrupted, re-copy it from the original source media or backup repository.
Step 4: Rebuild the Backup Set Reference (If Using a Media Set)
- If the backup was created with
WITH MEDIANAMEor as part of a named media set, confirm theMEDIANAMEandMEDIAPASSWORD(if applicable) match across all volumes usingRESTORE HEADERONLY. - Avoid mixing volumes from different backup operations into a single RESTORE statement, as this causes sequence mismatches even if filenames appear similar.
Alternative or Verification Steps
- After a successful restore, verify database consistency by running
DBCC CHECKDB('YourDB') WITH NO_INFOMSGSto confirm no corruption was introduced during the restore process. - If the correct sequence still fails, take a fresh full backup of the source database (if accessible) using
BACKUP DATABASE ... TO DISKwith a single destination file to eliminate multi-volume sequencing issues entirely.