检索网络上的SQL Server实例 [英] Retriving SQL server instances on the network

查看:87
本文介绍了检索网络上的SQL Server实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在尝试获取网络上所有SQL Server实例的名称.我正在使用SMO(服务器管理对象).问题在于对

Hi
I am trying to get the names of all SQL server instances on the network. I am using the SMO (server management objects). The problem is that the call to

SmoApplication.EnumAvailableSqlServers(false)

的调用返回的DataSet仅包含服务器名称,而不包含已安装实例的名称.即使在一台计算机上安装了多个实例,我也只能获得一个代表该计算机的DataRow.更糟糕的是实例"数据列为空(DBNull.Value).在测试环境中,我正在使用SQL Server 2008 Express.如果有人有任何想法,可能是什么原因,或者知道实现上述功能的任何其他方法,请告诉我.任何建议将被认真考虑.

Uros

returns a DataSet containing only the names of the servers not the installed instances. Even though there are multiple instances installed on single machine I get only one DataRow representing that machine. What is even worst is that the "Instance" DataColumn is empty(DBNull.Value). In the test environment I am using SQL server 2008 express. If anybody has any idea what could be the reason for that or knows any other approach to achieve the described functionality please let me know. Any advice will be appreciated.

Uros

推荐答案

请参阅此CodeProject文章.在本地网络上找到SQL Server实例 [ ^ ].
Have a look at this CodeProject article.Locate SQL Server instances on the local network[^].




事实证明,解决方案比我想象的要简单.问题是SQL Server浏览器服务已停止.在服务启动时运行上述smo命令时,您会获得所有正在运行的实例及其属性(InstanceName,Version,IsClustered ...)

乌鲁斯人
Hi

It turn''s out that the solution was simpler than I thought. The problem was that the SQL Server Browser service was stopped. When running the above smo command while the service is started you get all the running instances along with their properties(InstanceName, Version, IsClustered ...)

Uros


这篇关于检索网络上的SQL Server实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆