How to fix MSSQLLocalDB?

Andrew Savinykh picture Andrew Savinykh · Nov 9, 2015 · Viewed 11.4k times · Source

On my machine MSSQLLocalDB got corrupted:

    PS C:\WINDOWS\system32> sqllocaldb i
    MSSQLLocalDB
    Projects
    ProjectsV12
    v11.0
    PS C:\WINDOWS\system32> sqllocaldb i mssqllocaldb
    The required LocalDB version "0.0" is not installed.
    PS C:\WINDOWS\system32>

Is there anything I can do short of reinstalling Visual Studio / Sql Server / Sql Express to fix it?

I should mention that any Visual Studio functionality that is dependent on LocalDb is not working because of this, for example CodeMaps

Answer

Simon_Weaver picture Simon_Weaver · Mar 11, 2016

This can occur if you've just installed LocalDB and haven't started the instance yet. I'm not sure if rebooting would have restarted it for me (I imagine it would have), but the following worked without needing to:

C:\Users\sweaver>sqllocaldb.exe s MSSQLLocalDB
LocalDB instance "MSSQLLocalDB" started.

That should be all you need - but here is the full diagostics steps I used in the process.


This is before installing new version of LocalDB (2014)

C:\Users\sweaver>sqllocaldb.exe i
v11.0

Afterwards

C:\Users\sweaver>sqllocaldb.exe i
MSSQLLocalDB
v11.0

Then I immediately get this error

C:\Users\sweaver>sqllocaldb.exe i MSSQLLocalDB
The required LocalDB version "0.0" is not installed.

Strange! What about version 11 - that's ok

C:\Users\sweaver>sqllocaldb.exe i v11.0
Name:               v11.0
Version:            11.0.5343.0
Shared name:
Owner:              RR2014\sweaver
Auto-create:        Yes
State:              Running
Last start time:    3/10/2016 3:00:29 PM
Instance pipe name: np:\\.\pipe\LOCALDB#60C1AC49\tsql\query

Here's the versions

C:\Users\sweaver>sqllocaldb.exe v
Microsoft SQL Server 2012 (11.0.5343.0)
Microsoft SQL Server 2014 (12.0.2000.8)

Let's try starting it

C:\Users\sweaver>sqllocaldb.exe s MSSQLLocalDB
LocalDB instance "MSSQLLocalDB" started.

And try again...

C:\Users\sweaver>sqllocaldb.exe i MSSQLLocalDB
Name:               MSSQLLocalDB
Version:            12.0.2000.8
Shared name:
Owner:              RR2014\sweaver
Auto-create:        Yes
State:              Running
Last start time:    3/10/2016 3:10:55 PM
Instance pipe name: np:\\.\pipe\LOCALDB#1D3F49F3\tsql\query

Phew! That was easy!