SQLLocalDB doesn't start
Asked Answered
C

1

8

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.

Caprifoliaceous answered 28/7, 2022 at 7:11 Comment(15)
2 notes: the c switch creates a new instance. To start an existing one, use s instead. Also, I highly recommend to avoid any elevation of privileges when dealing with LocalDB instances. They are per-user instances by default, and as such, don't require UAC elevation.Paradigm
It's same error for s or c switch. I tried to put what I have done to narrow down issue.Caprifoliaceous
C:\Windows\system32>sqllocaldb s MSSQLLocalDB Start of LocalDB instance "MSSQLLocalDB" failed because of the following error: Error occurred during LocalDB instance startup: SQL Server process failed to start.Caprifoliaceous
Are you sure that's all there is in error.log?Talia
yes, copied entire log file.Caprifoliaceous
Did you notice this, There have been 256 misaligned log IOs which required falling back to synchronous IO? What's the output of fsutil fsinfo ntfsinfo C:\ ? Seems like you're on a hybrid disk that uses 4096 byte sectors natively while reporting 512 byte sectors to the operating system. Since you're on CU12 it seems like you need to install KB5011644 - Cumulative Update 16 for SQL Server 2019.Topliffe
C:\Windows\system32>fsutil fsinfo ntfsinfo c:\ NTFS Volume Serial Number : 0x4ccac472cac45a3a NTFS Version : 3.1 LFS Version : 2.0 Total Sectors : 578,195,455 (275.7 GB) Total Clusters : 72,274,431 (275.7 GB) Free Clusters : 55,090,666 (210.2 GB) Total Reserved Clusters : 1,710,041 ( 6.5 GB) Reserved For Storage Reserve : 1,698,368 ( 6.5 GB) Bytes Per Sector : 512 Bytes Per Physical Sector : 4096Caprifoliaceous
Bytes Per Cluster : 4096 (4 KB) Bytes Per FileRecord Segment : 1024 Clusters Per FileRecord Segment : 0 Mft Valid Data Length : 383.25 MB Mft Start Lcn : 0x00000000000c0000 Mft2 Start Lcn : 0x0000000000000002 Mft Zone Start : 0x00000000006b3820 Mft Zone End : 0x00000000006b5d00 MFT Zone Size : 36.88 MB Max Device Trim Extent Count : 256 Max Device Trim Byte Count : 0xffffffff Max Volume Trim Extent Count : 62Caprifoliaceous
Installed KB5011644. Its same error, no change. C:\Windows\system32>sqllocaldb v Microsoft SQL Server 2019 (15.0.4223.1)Caprifoliaceous
C:\Windows\system32>sqllocaldb s MSSQLLocalDB Start of LocalDB instance "MSSQLLocalDB" failed because of the following error: Error occurred during LocalDB instance startup: SQL Server process failed to start.Caprifoliaceous
Does the Windows Application event log have any details of an error?Talia
Windows app event log already mentioned in ticket, reference : "Event viewer shows below log"Caprifoliaceous
one more event of error (Event ID: 1000): Faulting application name: sqlservr.exe, version: 2019.150.4223.1, time stamp: 0x6254cb09 Faulting module name: ntdll.dll, version: 10.0.22000.832, time stamp: 0x3907dfbc Exception code: 0xc0000005 Fault offset: 0x00000000000a8ed7 Faulting process id: 0xd18 Faulting application start time: 0x01d8a26e53973f0d Faulting application path: C:\Program Files\Microsoft SQL Server\150\LocalDB\Binn\sqlservr.exe Faulting module path: C:\Windows\SYSTEM32\ntdll.dll Report Id: b674d41e-5305-4813-be8c-a44793c02438 Faulting package full name:Caprifoliaceous
Try updating to the latest CU maybe? support.microsoft.com/en-us/topic/… Can't remember exactly how you do that with LocalDBTalia
I did this with latest CU. Now its latest upto version 15.0.4223.1Caprifoliaceous
A
16

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.

  1. Start a Command Prompt as Administrator

  2. 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

enter image description here

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.

Anthropomorphic answered 27/8, 2022 at 17:38 Comment(2)
Insightful answer, thank you very much for your effort.Matron
I manage to delete or create, but not to start the process.Carib

© 2022 - 2024 — McMap. All rights reserved.