将 SQL Server 命名实例更改为默认实例

6

这个问题涉及到实例。我之前问过,是否可能在不卸载和重新安装的情况下更改SQL Server中的默认实例?如果可能的话,我们该如何操作?如果不可能,为什么呢?谢谢您的帮助:)


2
这就是为什么我们更喜欢使用命名实例的原因... - OMG Ponies
我认为没有重新安装是不可能的,但我不能百分之百确定。问题是,你为什么想要更改默认实例?为什么命名实例对你不起作用? - shashi
@sassyboy 我只想使用 IP 工作 :) - kinkajou
4个回答

13

所有实例都有名称,但只有一个作为默认运行。在SQL Server Config Manager的SQL Server Network Config下,从默认实例中删除端口,并将想要设为默认的命名实例的端口设置为1433。


5
这可能会解决您的问题:https://kohera.be/blog/sql-server/make-named-instance-look-like-default-instance/(全文归功于Stefan,但我将在下面进行释义以防他的博客消失)。
思路是使您的命名实例显示为默认实例。
  1. 打开SQL Server配置管理器。
  2. 导航到:SQL Server网络配置 ->“XYZ”的“协议”树节点。
  3. 右键单击右窗格中的TCP/IP项目。
  4. 选择“属性”菜单项。
  5. 在协议选项卡上,确保启用设置为“是”。
  6. 在IP地址选项卡上,滚动到底部,在IPAll-> TCP动态端口字段中输入1433。
  7. 然后重新启动命名实例。
  8. 现在,您应该能够通过以下方式连接到您的命名实例:
    • (本地)
    • localhost
    • . ( <-- 这是一个点 )
    • 127.0.0.1
    • 命名实例名称(例如mymachine\myinstance)

enter image description here enter image description here enter image description here


我将TCP动态端口设置为默认值,而是将TCP端口设置为默认实例的默认端口1433。与您的回答非常相似。这对我很有效,并允许我在SSMS的服务器名称字段中简单地输入.。太棒了! :) - Chiramisu

4

编号。

如果您想更改实例的名称或将其设置为默认实例,则必须重新安装。没有其他办法。


对于其他寻找答案的人,这回答了问题,但为了解决问题的意图,请查看其他答案或转到https://dev59.com/KnVD5IYBdhLWcg3wRpaX#11921896 - GaTechThomas
@GaTechThomas:这并不是将命名实例重命名为(无名的)默认实例。我坚持我的答案-如果你真的想重命名实例,除了重新安装,你别无选择。没有其他办法。 - marc_s
感谢 @mark_s... 我从吃了亏才知道像 @@servername 这样的东西会受到使用多个实例的影响。当你在构建脚本(遗留决策)中有 @@servername 时,重新构建服务器可能是值得的。 - GaTechThomas

3
"If you want to access a named instance from any connection string without using the instance name, and using only the server name, then you can do as follows:
To access a named instance with just the host name - go to SQL Server Configuration Manager, and enable TCP/IP for that named instance. Right-click and go to properties, and in the IP tab, go to IP All section and make TCP Dynamic Ports blank, and make TCP Port 1433 (which is the default).
This will make the named instance listen on the default port. Note: You can have only one instance configured like this - no two instances can have the same port on the IP All section unless the instance is a failover cluster.
See Zasz's answer. He explains with screenshots how you can set which server listens on the default port."

https://dev59.com/KnVD5IYBdhLWcg3wRpaX#11921896


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接