SmoApplication.EnumAvailableSqlServers() does not list default instance if sqlexpress is in same machine where SQLSERVER2008 installed

亡梦爱人 提交于 2019-12-23 05:28:01

问题


I am using SMO to find available sqlservers of a network.But in one machine where i running

application it doesnot give Default instance name but for all other machines it gives the

named and default instance wil be showing.

Observe my Scenario.

Ex: Machine Name :rkwrk3-vm-sr (local machine from where i am running app in which

sqlserver2008 installed)

in this actually i have sql2008 as default instance and sqlexpress(2005) as named instance...

But it shows only one instance rkwrk3-vm-sr\sqlexpress and it doesnot ahows rkwrk3-vm-sr.

and some other machines Hr-2k3-tm(where sqlserver2005 installed)

for this it is showing Hr-2k3-tm and Hr-2k3-tm/sqlexpress

How can i fix this .Any Help wil Greately Appreciated.

Thanks in Advance.


回答1:


The instance discovery protocol (the UDP on 1434) is served by the SQL Browser service, which by default is disabled (in memory of a thing named Slammer...).

Make sure the service is enabled and started on all machines.




回答2:


You might have better luck using an alternate method to get the server list. Perhaps this method recommended by Microsoft that uses the System.Data.Sql.SqlDataSourceEnumerator.Instance

Enumerating Instances of SQL Server
http://msdn.microsoft.com/en-us/library/a6t1z9x2.aspx

Or this method:

Enumerate SQL Server Instances in C#, Using ODBC
http://www.codeproject.com/KB/database/SubmitSQLInfoEnumerator.aspx



来源:https://stackoverflow.com/questions/1131953/smoapplication-enumavailablesqlservers-does-not-list-default-instance-if-sqlex

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!