连接到多实例 SQL Server 而不指定实例
我有一个 SQL 服务器,上面有 3 个实例。 如果我使用 Management Studio 连接到它,我会自动连接到其中一个实例。每次都一样。
看起来实例之间有一个默认的命名实例......这是真的吗?如果我连接来自 Management Studio 以外的另一个客户端的实例名称(fx SSIS 包),会是同样的事情吗?
谢谢 尼古拉伊
I have an SQL server with 3 instances on it.
If I connect to it with Management Studio i automatically connect to one of the instances. the same each time.
It looks like there is a default named instance between the instances.... is that true? and will it be the same thing if i connect withour an instance name from another client than Management Studio (fx a SSIS package)?
Thx
Nicolaj
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SQL Server 浏览器服务负责将服务器的连接定向到适当的 SQL Server 实例。当您仅使用计算机名称连接到 SQL Server 时,它会假定您正在连接到默认实例并将您定向到端口 1433。当您连接到命名实例时,它会获取实例的名称并将其转换为端口该实例正在侦听(默认情况下它使用动态端口)。您可以完全绕过浏览器服务,直接连接到您想要的端口,该名称只是一个快捷方式,让您不必一直查找端口。
如果您采用一个命名实例并将端口从动态更改为 1433,则您将能够仅使用服务器名称连接到它,因为 1433 是默认端口。因此,在您的情况下,要么您有 2 个命名实例和 1 个默认实例,并且您每次都连接到默认实例,要么有人将其中一个命名实例的端口更改为 1433。
The SQL Server browser service is responsible for directing connections into the server to the appropriate instance of SQL Server. When you connect to SQL Server using only the computer name, it assumes that you are connecting to the default instance and directs you to port 1433. When you connect to a named instance, it takes the name of the instance and translates that to the port that that instance is listening on (by default it uses dynamic ports). You could bypass the browser service altogether and just connect directly to the port that you want, the name is just a shortcut to keep you from having to look up the port all the time.
If you take one of your named instances and change the port from dynamic to 1433, you will be able to connect to it with only the server name since 1433 is the default port. So in your case, either you have 2 named instances and one default instance and you're connecting to the default instance every time, or someone has changed the port of one of your named instances to 1433.