SQL Server, convert a named instance to default instance?

 ̄綄美尐妖づ 提交于 2019-11-26 15:38:34
SQLMenace

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

Zasz

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

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:

  • Open SQL Server Configuration Manager
  • Click SQL Server Network Configuration
  • Click Protocols for INSTANCENAME you want to make available (i.e. SQLExpress)
  • Right-click TCP/IP and click Enabled
  • Right-click TCP/IP and go to Properties
    • Go to the IP Addresses tab
    • Scroll down to the IPAll section
    • Clear the field TCP Dynamic Ports (i.e. empty/blank)
    • Set TCP Port to 1433
    • Click Ok
  • Go to SQL Server Services
  • Right-click your SQL Server (INSTANCENAME) and click Restart

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.

Portman

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.

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

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.

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.

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

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"

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