Troubleshooting Guide: SQL Server Error 3128 — Unsupported Page Size
Why This Error Happens
Error 3128 occurs when SQL Server 2025 attempts to read a data or log file whose page size does not match the page size expected by the current Database Engine (typically due to file corruption, an incomplete write operation, or the file being copied/attached from an incompatible or non-SQL Server source). This can also happen when a backup or .mdf/.ldf file has been truncated, damaged during transfer (e.g., FTP in ASCII mode instead of binary), or edited by a non-SQL Server tool. In rare cases, it stems from attempting to attach a file from a radically different or unsupported SQL Server version/build that used an incompatible page structure.
Step-by-Step Resolution Guide
Step 1: Verify File Integrity and Source
- Confirm the file wasn’t corrupted during transfer by checking file size against the original source (
Get-Item "D:\Data\YourDB.mdf" | Select Length). - If the file was moved via FTP, SMB, or cloud sync, re-copy it using binary/raw transfer mode and avoid any tool that may alter file encoding.
- Check the Windows Event Viewer under Windows Logs > Application for related disk I/O or storage driver errors (Event ID 153 or 154) that may indicate underlying disk corruption.
Step 2: Validate SQL Server Version Compatibility
- Run
SELECT @@VERSION;in SQL Server Management Studio (SSMS) to confirm the current build of SQL Server 2025. - Check the source database’s original version/build using
DBCC TRACEON(3604); DBCC PAGE(...)(if accessible) or consult backup metadata viaRESTORE HEADERONLY FROM DISK = 'D:\Backup\YourDB.bak';. - If the file originated from an unsupported preview build, non-Microsoft SQL engine, or a heavily modified fork, do not attempt to attach it directly — restore from a verified full backup instead.
Step 3: Attempt Database Restore Instead of Attach
- Rather than using
sp_attach_dbor Attach in SSMS, perform a fullRESTORE DATABASEcommand, which validates page structures during the restore process:
RESTORE DATABASE YourDB
FROM DISK = 'D:\Backup\YourDB.bak'
WITH MOVE 'YourDB_Data' TO 'D:\Data\YourDB.mdf',
MOVE 'YourDB_Log' TO 'D:\Data\YourDB_log.ldf',
REPLACE;
- If restore also fails with Error 3128, the backup file itself is likely corrupted at the page level.
Step 4: Run Disk and File System Diagnostics
- On Windows Server 2025 / Windows 11, run
chkdsk D: /f /r(replaceD:with the drive hosting your SQL files) to rule out underlying disk sector corruption. - Check that the storage subsystem (especially on virtualized or SAN-backed volumes) is reporting no write-cache or block-size mismatches — an 8KB SQL Server page size mismatch with the underlying storage sector size can trigger this error.
Step 5: Rebuild or Recover from a Clean Backup
- If the file is unrecoverable, discard it and restore from the most recent known-good backup set stored in
D:\Backup\or your backup vendor’s repository. - If no backup exists, engage SQL Server emergency repair mode only as a last resort:
ALTER DATABASE YourDB SET EMERGENCY;
DBCC CHECKDB(YourDB, REPAIR_ALLOW_DATA_LOSS);
Alternative or Verification Steps
- After restoring, run
DBCC CHECKDB('YourDB') WITH NO_INFOMSGS, ALL_ERRORMSGS;to confirm there are no further page-level consistency errors. - If the issue recurs only on specific storage volumes, migrate the database files to a different physical or virtual disk and re-test to rule out a storage controller or block-size configuration problem.