Reputation: 91
SQLLocalDB doesn't start and throws an error as below.
**C:\Windows\system32>sqllocaldb c MSSQLLocalDB**
Creation of LocalDB instance "MSSQLLocalDB" failed because of the following error:
Error occurred during LocalDB instance startup: SQL Server process failed to start.
***Note:*** Command started with Run as Administrator.
Event viewer shows below log:
Windows API call WaitForMultipleObjects returned error code: 575. Windows system error message is: {Application Error}
The application was unable to start correctly (0x%lx). Click OK to close the application.
Reported at line: 3714.
Source: SQLLocalDB 15.0
Event ID: 528
Level: Error
Operating system: Windows 11 Pro build 22000.832
Version installed: Microsoft SQL Server 2019 (15.0.4153.1)
While connecting SQLLocalDB from Visual Studio 2022 version 17.2.6, it shows below message:
TITLE: Error
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Error occurred during LocalDB instance startup: SQL Server process failed to start.
) (Microsoft SQL Server, Error: -1983577846)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=-1983577846&LinkId=20476
------------------------------
Error Number: -1983577846
Severity: 20
State: 0
Below is detail from file <error.log>:
2022-07-28 12:13:11.50 Server Microsoft SQL Server 2019 (RTM-CU12) (KB5004524) - 15.0.4153.1 (X64)
Jul 19 2021 15:37:34
Copyright (C) 2019 Microsoft Corporation
Express Edition (64-bit) on Windows 10 Pro 10.0 <X64> (Build 22000: )
2022-07-28 12:13:11.50 Server UTC adjustment: 5:30
2022-07-28 12:13:11.50 Server (c) Microsoft Corporation.
2022-07-28 12:13:11.50 Server All rights reserved.
2022-07-28 12:13:11.50 Server Server process ID is 10072.
2022-07-28 12:13:11.50 Server System Manufacturer: 'LENOVO', System Model: '82KB'.
2022-07-28 12:13:11.50 Server Authentication mode is MIXED.
2022-07-28 12:13:11.50 Server Logging SQL Server messages in file 'C:\Users\<user>\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB\error.log'.
2022-07-28 12:13:11.50 Server The service account is '<domain\user>'. This is an informational message; no user action is required.
2022-07-28 12:13:11.50 Server Command Line Startup Parameters:
-c
-S "MSSQL15E.LOCALDB"
-s "LOCALDB#C0C8C320"
-d "C:\Users\<user>\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB\master.mdf"
-l "C:\Users\<user>\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB\mastlog.ldf"
-e "C:\Users\<user>\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB\error.log"
2022-07-28 12:13:11.51 Server SQL Server detected 1 sockets with 4 cores per socket and 8 logical processors per socket, 8 total logical processors; using 8 logical processors based on SQL Server licensing. This is an informational message; no user action is required.
2022-07-28 12:13:11.51 Server SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2022-07-28 12:13:11.51 Server Detected 16183 MB of RAM. This is an informational message; no user action is required.
2022-07-28 12:13:11.51 Server Using conventional memory in the memory manager.
2022-07-28 12:13:11.51 Server Page exclusion bitmap is enabled.
2022-07-28 12:13:11.64 Server Buffer Pool: Allocating 2097152 bytes for 1740277 hashPages.
2022-07-28 12:13:11.66 Server Default collation: SQL_Latin1_General_CP1_CI_AS (us_english 1033)
2022-07-28 12:13:11.67 Server Buffer pool extension is already disabled. No action is necessary.
2022-07-28 12:13:11.70 Server Query Store settings initialized with enabled = 1,
2022-07-28 12:13:11.70 Server The maximum number of dedicated administrator connections for this instance is '1'
2022-07-28 12:13:11.70 Server Node configuration: node 0: CPU mask: 0x00000000000000ff:0 Active CPU mask: 0x00000000000000ff:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
2022-07-28 12:13:11.70 Server Using dynamic lock allocation. Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node. This is an informational message only. No user action is required.
2022-07-28 12:13:11.71 Server In-Memory OLTP initialized on standard machine.
2022-07-28 12:13:11.71 Server [INFO] Created Extended Events session 'hkenginexesession'
2022-07-28 12:13:11.71 Server Database Instant File Initialization: disabled. For security and performance considerations see the topic 'Database Instant File Initialization' in SQL Server Books Online. This is an informational message only. No user action is required.
2022-07-28 12:13:11.72 Server Total Log Writer threads: 2. This is an informational message; no user action is required.
2022-07-28 12:13:11.73 Server clwb is selected for pmem flush operation.
2022-07-28 12:13:11.73 Server Software Usage Metrics is disabled.
2022-07-28 12:13:11.74 spid9s Starting up database 'master'.
2022-07-28 12:13:11.75 spid9s There have been 256 misaligned log IOs which required falling back to synchronous IO. The current IO is on file C:\Users\<user>\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB\master.mdf.
Tried so far: I have tried removing SSIS, VS, Registry keys, folders etc. Even I install clean Windows 11 again to avoid this issue of residual files /registry post uninstall.
My domain account is already in administrator groups on this computer. But I have also added into sysadmin additionally. Folder already has enough permission where MDF files are there.
Upvotes: 9
Views: 6363
Reputation: 1790
I had the same setup and issue as you listed on a Localdb instance, including the same SQL Server error log.
The following troubleshooting article from Microsoft docs provided a fix.
https://learn.microsoft.com/en-us/troubleshoot/sql/admin/troubleshoot-os-4kb-disk-sector-size
The error message listed in the error log you posted is described in 'Scenario #2' in the article.
2021-11-05 23:42:47.14 spid9s There have been 256 misaligned log IOs which required falling back to synchronous IO. The current IO is on file C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\master.mdf.
From the Causes section of the article:
During service startup, SQL Server begins the database recovery process to ensure database consistency. Part of this database recovery process involves consistency checks on the underlying filesystem before attempting the activity of opening system and user database files.
On systems running Windows 11, some new storage devices and device drivers will expose a disk sector size greater than the supported 4 KB sector size.
When this occurs, SQL Server will be unable to start due to the unsupported file system as SQL Server currently supports sector storage sizes of 512 bytes and 4 KB.
The Resolutions section of the troubleshooting article states:
Microsoft is currently investigating this problem. Consider one of the following solutions:
I used the following step and it fixed the issue:
You can add a registry key which will cause the behavior of Windows 11 and later to be similar to Windows 10. This will force the sector size to be emulated as 4 KB in size. To add the ForcedPhysicalSectorSizeInBytes registry key, use the Registry Editor, or you can run one of the following commands in Windows command prompt or PowerShell, executed as an administrator.
Start a Command Prompt as Administrator
Add key to the Windows Registry by entering the following in the command prompt:
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device" /v "ForcedPhysicalSectorSizeInBytes" /t REG_MULTI_SZ /d "* 4095" /f
Restart your machine after the registry entry is made. I had to delete the existing mssqllocaldb and recreate it after restarting my machine. From a Command Prompt as Adminstrator
Sqllocaldb delete mssqllocaldb
Sqllocaldb create mssqllocaldb -s
This link described the same issue as the troubleshooting article as well. I encountered the failed SQL Server startup issue using a new Samsung laptop.
Upvotes: 19