SQL Server,将命名实例转换为默认实例?

时间:2022-12-27 10:21:21

I need to convert a named instance of SQL server 2005, to a default instance.

我需要将SQL server 2005的命名实例转换为默认实例。

Is there a way to do this without a reinstall?

有没有一种不用重新安装就能完成的方法?


The problem is, 2 out of 6 of the developers, installed with a named instance. So its becoming a pain changing connection strings for the other 4 of us. I am looking for the path of least resistance to getting these 2 back on to our teams standard setup.

问题是,6个开发人员中有2个安装了命名实例。所以它变成了一种痛苦的改变我们其他4个人的联系。我正在寻找能让这两个回到我们团队标准设置的最小阻力的路径。

Each has expressed that this is going to be, too much trouble and that it will take away from their development time. I assumed that it would take some time to resolve, in the best interest of all involved, I tried combing through configuration apps installed and didn't see anything, so I figured someone with more knowledge of the inner workings would be here.

每个人都表示,这会带来太多的麻烦,会占用他们的开发时间。我认为这需要一段时间才能解决,出于最大的利益考虑,我试着对安装的配置应用程序进行梳理,但什么也没看到,所以我猜想,对内部工作原理有更多了解的人会在这里。

7 个解决方案

#1


18  

As far as I know, no. One reason is the folder structure on the hard drive; they will have a name like MSSQL10.[instancename]

据我所知,没有。一个原因是硬盘上的文件夹结构;他们会有一个像MSSQL10这样的名字。

#2


333  

I also wanted to convert a named instance to default - my reason was to access it with just the machine name from various applications.

我还想将命名实例转换为default——我的理由是使用来自不同应用程序的机器名来访问它。

If you want to access a named instance from any connection string without using the instance name, and using only the server name and/or IP address, then you can do the following:

如果您想从任何连接字符串访问一个命名的实例,而不使用实例名,并且只使用服务器名称和/或IP地址,那么您可以执行以下操作:

  • Open SQL Server Configuration Manager
  • 打开SQL Server配置管理器
  • Click SQL Server Network Configuration
  • 单击SQL Server网络配置
  • Click Protocols for INSTANCENAME you want to make available (i.e. SQLExpress)
  • 单击要提供的实例名的协议(例如,SQLExpress)
  • Right-click TCP/IP and click Enabled
  • 右键单击TCP/IP并单击启用。
  • Right-click TCP/IP and go to Properties
    • Go to the IP Addresses tab
    • 转到IP地址选项卡。
    • Scroll down to the IPAll section
    • 向下滚动到IPAll部分。
    • Clear the field TCP Dynamic Ports (i.e. empty/blank)
    • 清除字段TCP动态端口(即空/空)
    • Set TCP Port to 1433
    • 将TCP端口设置为1433
    • Click Ok
    • 单击Ok
  • 右键单击TCP/IP,转到属性转到IP地址选项卡向下滚动到IPAll部分,清除字段TCP动态端口(即空/空),将TCP端口设置为1433,单击Ok
  • Go to SQL Server Services
  • 转到SQL Server服务
  • Right-click your SQL Server (INSTANCENAME) and click Restart
  • 右键单击SQL Server (INSTANCENAME)并单击Restart

SQL Server,将命名实例转换为默认实例?

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 same port on the IP All section unless the instance is a failover cluster.

这将使命名实例侦听缺省端口。注意:您只能有一个这样配置的实例——没有两个实例可以在IP All部分上有相同的端口,除非该实例是一个故障转移集群。

#3


14  

This is why a lot of companies store their applications' connection strings at the machine level instead of the application level.

这就是为什么许多公司将应用程序的连接字符串存储在机器级而不是应用级。

Just take the connection string out of the source code entirely. Then have everyone put their connection string in their machine.config.

只需将连接字符串从源代码中删除即可。然后让每个人把他们的连接字符串放到他们的机器。

This has the added benefit of avoiding unnecessary app-specific environment logic, i.e. when you copy your application to the staging server, the staging server already "knows" what database to use.

这增加了避免不必要的应用程序特定环境逻辑的好处,即当您将应用程序复制到staging服务器时,staging服务器已经“知道”要使用的数据库。

#4


2  

The only way to change the instance name is to re-install - uninstall and install as default instance.

更改实例名的惟一方法是重新安装—卸载并作为默认实例安装。

#5


2  

A lot of times I'll use client alias to point an application at a different sql server than the ones it's connection string is for, esp. handy when working on DTS or an application with a hard coded connection string. Have everybody use a commonly named alias, use the alias in the connection string and point the alias’s on each dev box to the to the different instances. That way you won't have to worry about if the server is the default instance or not.

很多时候,我将使用客户端别名将应用程序指向不同的sql服务器,特别是在处理DTS或使用硬编码连接字符串的应用程序时。让每个人都使用一个通常命名的别名,在连接字符串中使用别名,并将每个开发框上的别名指向不同的实例。这样,您就不必担心服务器是否是默认实例。

#6


0  

You shouldn't ever really need to do this. Most software that claims to require the default instance (like Great Plains or Dynamics) doesn't actually.

你不应该真的需要这么做。大多数声称需要默认实例(如Great Plains或Dynamics)的软件实际上并不需要。

If you repost with your situation (installed X, then Y, but need to accomplish Z) I bet you'll get some good workarounds.

如果您重新发布您的情况(安装了X,然后安装了Y,但是需要完成Z),我打赌您会得到一些好的解决方案。

#7


0  

I think you can migrate your data from Sql Server without having default instance installed. You can just specify the port number of your Sql Server instance in Oracle Sql Developer and you can connect just using the server name, not using the server name and the instance. Like this: connect to "MYSERVER, 1433"

我认为您可以从Sql Server迁移数据,而无需安装默认实例。您可以在Oracle Sql Developer中指定Sql Server实例的端口号,您可以只使用服务器名进行连接,而不使用服务器名和实例。像这样:连接到“MYSERVER, 1433”

#1


18  

As far as I know, no. One reason is the folder structure on the hard drive; they will have a name like MSSQL10.[instancename]

据我所知,没有。一个原因是硬盘上的文件夹结构;他们会有一个像MSSQL10这样的名字。

#2


333  

I also wanted to convert a named instance to default - my reason was to access it with just the machine name from various applications.

我还想将命名实例转换为default——我的理由是使用来自不同应用程序的机器名来访问它。

If you want to access a named instance from any connection string without using the instance name, and using only the server name and/or IP address, then you can do the following:

如果您想从任何连接字符串访问一个命名的实例,而不使用实例名,并且只使用服务器名称和/或IP地址,那么您可以执行以下操作:

  • Open SQL Server Configuration Manager
  • 打开SQL Server配置管理器
  • Click SQL Server Network Configuration
  • 单击SQL Server网络配置
  • Click Protocols for INSTANCENAME you want to make available (i.e. SQLExpress)
  • 单击要提供的实例名的协议(例如,SQLExpress)
  • Right-click TCP/IP and click Enabled
  • 右键单击TCP/IP并单击启用。
  • Right-click TCP/IP and go to Properties
    • Go to the IP Addresses tab
    • 转到IP地址选项卡。
    • Scroll down to the IPAll section
    • 向下滚动到IPAll部分。
    • Clear the field TCP Dynamic Ports (i.e. empty/blank)
    • 清除字段TCP动态端口(即空/空)
    • Set TCP Port to 1433
    • 将TCP端口设置为1433
    • Click Ok
    • 单击Ok
  • 右键单击TCP/IP,转到属性转到IP地址选项卡向下滚动到IPAll部分,清除字段TCP动态端口(即空/空),将TCP端口设置为1433,单击Ok
  • Go to SQL Server Services
  • 转到SQL Server服务
  • Right-click your SQL Server (INSTANCENAME) and click Restart
  • 右键单击SQL Server (INSTANCENAME)并单击Restart

SQL Server,将命名实例转换为默认实例?

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 same port on the IP All section unless the instance is a failover cluster.

这将使命名实例侦听缺省端口。注意:您只能有一个这样配置的实例——没有两个实例可以在IP All部分上有相同的端口,除非该实例是一个故障转移集群。

#3


14  

This is why a lot of companies store their applications' connection strings at the machine level instead of the application level.

这就是为什么许多公司将应用程序的连接字符串存储在机器级而不是应用级。

Just take the connection string out of the source code entirely. Then have everyone put their connection string in their machine.config.

只需将连接字符串从源代码中删除即可。然后让每个人把他们的连接字符串放到他们的机器。

This has the added benefit of avoiding unnecessary app-specific environment logic, i.e. when you copy your application to the staging server, the staging server already "knows" what database to use.

这增加了避免不必要的应用程序特定环境逻辑的好处,即当您将应用程序复制到staging服务器时,staging服务器已经“知道”要使用的数据库。

#4


2  

The only way to change the instance name is to re-install - uninstall and install as default instance.

更改实例名的惟一方法是重新安装—卸载并作为默认实例安装。

#5


2  

A lot of times I'll use client alias to point an application at a different sql server than the ones it's connection string is for, esp. handy when working on DTS or an application with a hard coded connection string. Have everybody use a commonly named alias, use the alias in the connection string and point the alias’s on each dev box to the to the different instances. That way you won't have to worry about if the server is the default instance or not.

很多时候,我将使用客户端别名将应用程序指向不同的sql服务器,特别是在处理DTS或使用硬编码连接字符串的应用程序时。让每个人都使用一个通常命名的别名,在连接字符串中使用别名,并将每个开发框上的别名指向不同的实例。这样,您就不必担心服务器是否是默认实例。

#6


0  

You shouldn't ever really need to do this. Most software that claims to require the default instance (like Great Plains or Dynamics) doesn't actually.

你不应该真的需要这么做。大多数声称需要默认实例(如Great Plains或Dynamics)的软件实际上并不需要。

If you repost with your situation (installed X, then Y, but need to accomplish Z) I bet you'll get some good workarounds.

如果您重新发布您的情况(安装了X,然后安装了Y,但是需要完成Z),我打赌您会得到一些好的解决方案。

#7


0  

I think you can migrate your data from Sql Server without having default instance installed. You can just specify the port number of your Sql Server instance in Oracle Sql Developer and you can connect just using the server name, not using the server name and the instance. Like this: connect to "MYSERVER, 1433"

我认为您可以从Sql Server迁移数据,而无需安装默认实例。您可以在Oracle Sql Developer中指定Sql Server实例的端口号,您可以只使用服务器名进行连接,而不使用服务器名和实例。像这样:连接到“MYSERVER, 1433”