Credits and Thanks to https://blog.nimblepros.com/blogs/sql-server-windows-11-fiasco/
If you’ve run into an issue with LocalDB or SQL Server where the process fails to start and you see an error message about misaligned log IOs, you’re not alone. This issue can be particularly frustrating, especially if you’re not sure where to start in terms of troubleshooting. Here’s what I did to fix the problem and get LocalDB working again.
First things first, you’ll want to check the SQL Server log files to see if there are any clues as to what might be causing the issue. If like me you notice a message stating something like “there have been 256 misaligned log IOs which required falling back to synchronous IO”, you’re in luck. Well, you’re in luck in the sense that you’re reading the right article and hopefully we can get you out of this mess. If you don’t see this message, but something entirely different, sorry friend, it’s back to googling for you.
Ok, here’s what’s most likely going on. You have a modern SSD and you either:
- Tried installing SQL Server (or localDB) on a Windows 11 machine.
- Installed SQL Server (or localDB) on a Windows 10 machine, then upgraded to Windows 11.
Maybe you’re running into problems trying to install SQL Server or just starting it up. Either way, if you’re seeing the “misaligned log IOs” error message, the root cause is the same: Windows 11 doesn’t behave the same way as Windows 10 when it comes to disk sector sizes on modern SSDs.
From PowerShell, as an administrator, run the following command:
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device" -Name "ForcedPhysicalSectorSizeInBytes" -PropertyType MultiString -Force -Value "* 4095"
https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/database-file-operations/troubleshoot-os-4kb-disk-sector-size