Knowing instance names

Hi,

When i have multiple sql server instances running on one server, how to check the names of that instances with out connecting to sql server management studio.

Thanks

Shekar

 

July 2nd, 2015 11:57pm

1)cmd => sqlcmd -L or osql -L will list sql server

2)query :- select @@servername + '\' + @@servicename

Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2015 12:06am

You can go to the services console which will list Instances installed, the default being MSSQLSERVER.
July 3rd, 2015 12:11am

Hi,

When i have multiple sql server instances running on one server, how to check the names of that instances with out connecting to sql server management studio.

Thanks

Shekar

 

Or you can run Discovery report if you have SQL Server 2008 and above

or go to cmd and type osql -L

Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2015 12:12am

if you open the SQL server configuration manager and look for "SQL services" you will see all the instances.

Default instance is MSSQLSERVER. only one default instance is allowed per server.

Any other instance should be a named instance. 

July 3rd, 2015 1:04am

At a command line (press WINDOWS+R or hit START and then type CMD):

SQLCMD -L

or

OSQL -L (Note: must be a capital L)

This will list all the sql servers installed on your network. There are configuration options you can set to prevent a SQL Server from showing in the list. To do this...

At command line:

svrnetcn

In the enabled protocols list, select 'TCP/IP', then click properties. There is a check box for 'Hide server'.

Also, you can query this registry value to get the SQL version directly:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\ClientSetup\CurrentVersion

Alternatively you can query your instance name and then use sqlcmd with your instance name that you would like:

To see your instance name:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names

 Then execute this:

SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')

Also you can try the following PowerShell command: Get-Service | ?{ $_.Name -like "MSSQL*" }


Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2015 1:33am

As a further option: Create Inventory of SQL Server in Network as Html
July 3rd, 2015 1:56am

Note that the discovery mechanisms are not 100% guaranteed. The guaranteed way to see what instances are installed is to check the services (using either "services" or "SQL Server Configuration Manager" (or something similar tool/Script that does in the end check the registry for installed instances).
Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2015 3:04am

At a command line (press WINDOWS+R or hit START and then type CMD):

SQLCMD -L

or

OSQL -L (Note: must be a capital L)

This will list all the sql servers installed on your network. There are configuration options you can set to prevent a SQL Server from showing in the list. To do this...

At command line:

svrnetcn

In the enabled protocols list, select 'TCP/IP', then click properties. There is a check box for 'Hide server'.

Also, you can query this registry value to get the SQL version directly:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\ClientSetup\CurrentVersion

Alternatively you can query your instance name and then use sqlcmd with your instance name that you would like:

To see your instance name:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names

 Then execute this:

SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')

Also you can try the following PowerShell command: Get-Service | ?{ $_.Name -like "MSSQL*" }


July 3rd, 2015 5:29am

At a command line (press WINDOWS+R or hit START and then type CMD):

SQLCMD -L

or

OSQL -L (Note: must be a capital L)

This will list all the sql servers installed on your network. There are configuration options you can set to prevent a SQL Server from showing in the list. To do this...

At command line:

svrnetcn

In the enabled protocols list, select 'TCP/IP', then click properties. There is a check box for 'Hide server'.

Also, you can query this registry value to get the SQL version directly:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\ClientSetup\CurrentVersion

Alternatively you can query your instance name and then use sqlcmd with your instance name that you would like:

To see your instance name:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names

 Then execute this:

SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')

Also you can try the following PowerShell command: Get-Service | ?{ $_.Name -like "MSSQL*" }


Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2015 5:29am

Note that the discovery mechanisms are not 100% guaranteed. The guaranteed way to see what instances are installed is to check the services (using either "services" or "SQL Server Configuration Manager" (or something similar tool/Script that does in the end check the registry for installed instance
July 4th, 2015 12:50am

Shanky, I didn't know it might return incorrect version... Good to know. I never use browsing because it being unreliable.

Not returning all instances on the network is pretty obvious, and I believe that this wasn't what you were referring to.

But I've also seen plenty of reports where this switch didn't list instances on the local machine either. I never bothered to investigate this, but rather shrugged and considered it being among "might work, might not" things. :-)

Free Windows Admin Tool Kit Click here and download it now
July 4th, 2015 10:02am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics