Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server: How to find all localdb instance names

I have two versions (2012, 2014) of SQL Server Express LocalDB installed in my system.

How can I find all existing LocalDB instance names?

I found a way to do that using command line as mentioned in the answers section.

Is there a better and easy way to do it?

like image 385
vineel Avatar asked Mar 22 '16 14:03

vineel


People also ask

How do I find all instances of SQL Server?

To list all the SQL instances, navigate to the root directory and run the Get-Childitem to get the list. Note: The path SQLSERVER:\SQL\<ServerName> has all the installed SQL instances of the listed server.

What is LocalDB instance?

An instance of SQL Server Express LocalDB is an instance created by a user for their use. Any user on the computer can create a database using an instance of LocalDB, store files under their user profile, and run the process under their credentials. By default, access to the instance of LocalDB is limited to its owner.


2 Answers

I found SqlLocalDB utility that needs to be run on command line.

SqlLocalDB can be found in

C:\Program Files\Microsoft SQL Server\110\Tools\Binn 

or

C:\Program Files\Microsoft SQL Server\120\Tools\Binn 

To get all existing LocalDB instance names, use:

SqlLocalDB.exe i   info|i   Lists all existing LocalDB instances owned by the current user   and all shared LocalDB instances. 

To get detailed information about a specific LocalDB instance:

SqlLocalDB.exe i "MSSQLLocalDB"  info|i "instance name"   Prints the information about the specified LocalDB instance. 
like image 100
vineel Avatar answered Sep 18 '22 22:09

vineel


To list all localdb instances, take a look vineel's answer below!


If you want to list all databases of your default localdb instance using UI, look here (might not work with SSMS2019 anymore):

Just open your SSMS and connect to (LocalDB)\MSSQLLocalDB.
Now you will see all your LocalDB-Instances.

This works at least with SS2016.

enter image description here

like image 20
Legends Avatar answered Sep 19 '22 22:09

Legends