如何在创建命名实例后创建默认实例?

时间:2022-07-14 18:09:19

when installing SQLServer2005 developer edition (not express) I created a named instance:

在安装SQLServer2005开发人员版(不是快递)时,我创建了一个命名实例:

MYSERVERNAME/MYINSTANCENAME

Is it possible to

是否有可能

1) change the name of my named instance to default:

1)将我的命名实例的名称更改为默认值:

MYSERVERNAME

OR

要么

2) create a new default instance (MYSERVERNAME as above).

2)创建一个新的默认实例(如上所述的MYSERVERNAME)。

any help would be appreciated!

任何帮助,将不胜感激!

5 个解决方案

#1


7  

Hm, when I use the "Change" button in Add/Remove Programs, SQL Server 2005 setup offers me the instance selection screen, and even allows me to list the existing instances. (I'm running XP SP2, by the way.)

嗯,当我在“添加/删除程序”中使用“更改”按钮时,SQL Server 2005安装程序为我提供了实例选择屏幕,甚至允许我列出现有实例。 (顺便说一下,我正在运行XP SP2。)

I selected the "To install a new component, click here" link in the setup program, then selected SQL Server Database Services on the "Components to Install" screen to arrive at the instance selection screen that allows me to install a new default instance.

我在安装程序中选择了“安装新组件,单击此处”链接,然后在“要安装的组件”屏幕上选择SQL Server数据库服务,以到达允许我安装新默认实例的实例选择屏幕。

#2


5  

A default instance has a default instance name, but captures the computer's name, and uses it as an alias. Even if you change the computer name, the default instance will capture the new computer name, and use it as its alias. But the default instance name remains the same (like MSSQLSERVER).

默认实例具有默认实例名称,但会捕获计算机的名称,并将其用作别名。即使您更改了计算机名称,默认实例也将捕获新计算机名称,并将其用作别名。但默认实例名称保持不变(如MSSQLSERVER)。

This is why a default instance cannot be renamed. The default instance name is fixed, and it captures the computer name and uses it for its alias. Thus, only one (1) default instance can exist on a computer, because the default instance has a fixed name, and it always captures and uses the computer name for an alias. In other words, the default instance name is joined at the hip with the computer name (as an alias). Neither can be changed programmatically. Changing the computer name simply changes the alias attached to the default instance name.

这就是无法重命名默认实例的原因。默认实例名称是固定的,它捕获计算机名称并将其用作别名。因此,计算机上只能存在一(1)个默认实例,因为默认实例具有固定名称,并且它始终捕获并使用计算机名称作为别名。换句话说,默认实例名称在计算机名称(作为别名)时加入。两者都不能以编程方式更改。更改计算机名称只会更改附加到默认实例名称的别名。

If a default instance already exists, all other SQL installations on that computer will be forced to use a named instance (an alias, which cannot be the computer name).

如果已存在默认实例,则该计算机上的所有其他SQL安装将被强制使用命名实例(别名,该别名不能是计算机名称)。

Now in your case, during your first SQL installation, you chose to install it as a named instance, not a default instance. Thus you had no default instance, and thus you used an alias that was different from the computer name. You've never installed a default instance, therefore the installation did not capture the computer name for its alias.

现在,在您的第一次SQL安装期间,您选择将其安装为命名实例,而不是默认实例。因此,您没有默认实例,因此您使用了与计算机名称不同的别名。您从未安装过默认实例,因此安装未捕获其别名的计算机名称。

The major thing about default instances is that they capture and use the computer name as an alias, and there is absolutely no way to programmatically change a default instance name. However, you can change its alias by changing the computer name. But the computer name is still joined to the default instance name.

关于默认实例的主要问题是它们捕获并使用计算机名作为别名,并且绝对无法以编程方式更改默认实例名称。但是,您可以通过更改计算机名称来更改其别名。但计算机名仍然连接到默认实例名称。

An alias simply points to an SQL installation, so that the alias may use its engine. If the installation was not designated as a default instance, it simply means the installation is not attached at the hip with the computer name as its alias.

别名只是指向SQL安装,因此别名可以使用其引擎。如果未将安装指定为默认实例,则仅表示安装未附加在计算机名称作为其别名的时候。

I hope this helps, but if this is clear as mud, please forgive me.

我希望这会有所帮助,但如果这很清楚,请原谅我。

#3


2  

Going off of Alan's answer, when you install a new instance as the default instance, take note of the directories it is using to store data and log files (or create a default location like D:\MSSQL\Log and D:\MSSQL\Data).

关于Alan的回答,当您安装新实例作为默认实例时,请记下它用于存储数据和日志文件的目录(或创建默认位置,如D:\ MSSQL \ Log和D:\ MSSQL \数据)。

You can then detach the databases from the named instance and move the files to the new data and log directories and re-attach them in SSMS.

然后,您可以从命名实例中分离数据库,并将文件移动到新数据和日志目录,然后将它们重新附加到SSMS中。

#4


2  

Thanks. This worked for me with sql server 2008 r2 express as well.

谢谢。这对我来说也适用于sql server 2008 r2 express。

I had a default instance of 2005 installed, and only a named instance for a subsequent install of 2008.

我安装了2005的默认实例,并且只有一个命名实例用于后续安装的2008。

I uninstalled 2005 (Important: Copy any 2005 databases to a separate folder first).

我卸载了2005(重要:首先将任何2005数据库复制到一个单独的文件夹)。

Then I reinstalled 2008. You can get the installation exe from microsoft if you don't still have it.

然后我重新安装了2008.如果你还没有它,你可以从微软获得安装exe。

  1. Start installation and select "new installation or add feature".
  2. 开始安装并选择“新安装或添加功能”。
  3. Select option button for "new installation or add feature".
  4. 选择“新安装或添加功能”的选项按钮。
  5. Accept default instances feature. NEXT.
  6. 接受默认实例功能。下一个。
  7. Select default instance option. NEXT. (note instance ID is MSSQLSERVER).
  8. 选择默认实例选项。下一个。 (注意实例ID是MSSQLSERVER)。
  9. Continue to accept defauls unless you have a reason not to.
  10. 除非你有理由不接受,否则继续接受违约。

#5


0  

If you have installed a named instance. You cannot change the name to default. You can however: * make the named instance listen to the default port. * OR create aliases (with name like MSSQLServer or the IP address, as a trick) to make your clients work. * If this workaround doesn't help then your best bet is to uninstall SQL Complete and re-install again but chances are that the new installation might take the named instance's name again even if you selected 'default instance'. You can verify this in the SQL services to see if it is still taking the old name. In this case, the best way (which worked for me) is to install a new instance with the explicit name of MSSQLServer which is known to be the default instance name.

如果已安装命名实例。您无法将名称更改为默认名称。但是,您可以:*使命名实例侦听默认端口。 *或创建别名(名称如MSSQLServer或IP地址,作为一种技巧),以使您的客户工作。 *如果此解决方法没有帮助,那么最好的办法是卸载SQL Complete并重新安装,但即使您选择了“默认实例”,新安装也可能会再次获取命名实例的名称。您可以在SQL服务中对此进行验证,以确定它是否仍在使用旧名称。在这种情况下,最好的方法(对我有用)是安装一个具有显式名称MSSQLServer的新实例,该实例已知为默认实例名称。

Keep in mind also that SQL takes the computer name and uses it as an alias.

还要记住SQL获取计算机名称并将其用作别名。

#1


7  

Hm, when I use the "Change" button in Add/Remove Programs, SQL Server 2005 setup offers me the instance selection screen, and even allows me to list the existing instances. (I'm running XP SP2, by the way.)

嗯,当我在“添加/删除程序”中使用“更改”按钮时,SQL Server 2005安装程序为我提供了实例选择屏幕,甚至允许我列出现有实例。 (顺便说一下,我正在运行XP SP2。)

I selected the "To install a new component, click here" link in the setup program, then selected SQL Server Database Services on the "Components to Install" screen to arrive at the instance selection screen that allows me to install a new default instance.

我在安装程序中选择了“安装新组件,单击此处”链接,然后在“要安装的组件”屏幕上选择SQL Server数据库服务,以到达允许我安装新默认实例的实例选择屏幕。

#2


5  

A default instance has a default instance name, but captures the computer's name, and uses it as an alias. Even if you change the computer name, the default instance will capture the new computer name, and use it as its alias. But the default instance name remains the same (like MSSQLSERVER).

默认实例具有默认实例名称,但会捕获计算机的名称,并将其用作别名。即使您更改了计算机名称,默认实例也将捕获新计算机名称,并将其用作别名。但默认实例名称保持不变(如MSSQLSERVER)。

This is why a default instance cannot be renamed. The default instance name is fixed, and it captures the computer name and uses it for its alias. Thus, only one (1) default instance can exist on a computer, because the default instance has a fixed name, and it always captures and uses the computer name for an alias. In other words, the default instance name is joined at the hip with the computer name (as an alias). Neither can be changed programmatically. Changing the computer name simply changes the alias attached to the default instance name.

这就是无法重命名默认实例的原因。默认实例名称是固定的,它捕获计算机名称并将其用作别名。因此,计算机上只能存在一(1)个默认实例,因为默认实例具有固定名称,并且它始终捕获并使用计算机名称作为别名。换句话说,默认实例名称在计算机名称(作为别名)时加入。两者都不能以编程方式更改。更改计算机名称只会更改附加到默认实例名称的别名。

If a default instance already exists, all other SQL installations on that computer will be forced to use a named instance (an alias, which cannot be the computer name).

如果已存在默认实例,则该计算机上的所有其他SQL安装将被强制使用命名实例(别名,该别名不能是计算机名称)。

Now in your case, during your first SQL installation, you chose to install it as a named instance, not a default instance. Thus you had no default instance, and thus you used an alias that was different from the computer name. You've never installed a default instance, therefore the installation did not capture the computer name for its alias.

现在,在您的第一次SQL安装期间,您选择将其安装为命名实例,而不是默认实例。因此,您没有默认实例,因此您使用了与计算机名称不同的别名。您从未安装过默认实例,因此安装未捕获其别名的计算机名称。

The major thing about default instances is that they capture and use the computer name as an alias, and there is absolutely no way to programmatically change a default instance name. However, you can change its alias by changing the computer name. But the computer name is still joined to the default instance name.

关于默认实例的主要问题是它们捕获并使用计算机名作为别名,并且绝对无法以编程方式更改默认实例名称。但是,您可以通过更改计算机名称来更改其别名。但计算机名仍然连接到默认实例名称。

An alias simply points to an SQL installation, so that the alias may use its engine. If the installation was not designated as a default instance, it simply means the installation is not attached at the hip with the computer name as its alias.

别名只是指向SQL安装,因此别名可以使用其引擎。如果未将安装指定为默认实例,则仅表示安装未附加在计算机名称作为其别名的时候。

I hope this helps, but if this is clear as mud, please forgive me.

我希望这会有所帮助,但如果这很清楚,请原谅我。

#3


2  

Going off of Alan's answer, when you install a new instance as the default instance, take note of the directories it is using to store data and log files (or create a default location like D:\MSSQL\Log and D:\MSSQL\Data).

关于Alan的回答,当您安装新实例作为默认实例时,请记下它用于存储数据和日志文件的目录(或创建默认位置,如D:\ MSSQL \ Log和D:\ MSSQL \数据)。

You can then detach the databases from the named instance and move the files to the new data and log directories and re-attach them in SSMS.

然后,您可以从命名实例中分离数据库,并将文件移动到新数据和日志目录,然后将它们重新附加到SSMS中。

#4


2  

Thanks. This worked for me with sql server 2008 r2 express as well.

谢谢。这对我来说也适用于sql server 2008 r2 express。

I had a default instance of 2005 installed, and only a named instance for a subsequent install of 2008.

我安装了2005的默认实例,并且只有一个命名实例用于后续安装的2008。

I uninstalled 2005 (Important: Copy any 2005 databases to a separate folder first).

我卸载了2005(重要:首先将任何2005数据库复制到一个单独的文件夹)。

Then I reinstalled 2008. You can get the installation exe from microsoft if you don't still have it.

然后我重新安装了2008.如果你还没有它,你可以从微软获得安装exe。

  1. Start installation and select "new installation or add feature".
  2. 开始安装并选择“新安装或添加功能”。
  3. Select option button for "new installation or add feature".
  4. 选择“新安装或添加功能”的选项按钮。
  5. Accept default instances feature. NEXT.
  6. 接受默认实例功能。下一个。
  7. Select default instance option. NEXT. (note instance ID is MSSQLSERVER).
  8. 选择默认实例选项。下一个。 (注意实例ID是MSSQLSERVER)。
  9. Continue to accept defauls unless you have a reason not to.
  10. 除非你有理由不接受,否则继续接受违约。

#5


0  

If you have installed a named instance. You cannot change the name to default. You can however: * make the named instance listen to the default port. * OR create aliases (with name like MSSQLServer or the IP address, as a trick) to make your clients work. * If this workaround doesn't help then your best bet is to uninstall SQL Complete and re-install again but chances are that the new installation might take the named instance's name again even if you selected 'default instance'. You can verify this in the SQL services to see if it is still taking the old name. In this case, the best way (which worked for me) is to install a new instance with the explicit name of MSSQLServer which is known to be the default instance name.

如果已安装命名实例。您无法将名称更改为默认名称。但是,您可以:*使命名实例侦听默认端口。 *或创建别名(名称如MSSQLServer或IP地址,作为一种技巧),以使您的客户工作。 *如果此解决方法没有帮助,那么最好的办法是卸载SQL Complete并重新安装,但即使您选择了“默认实例”,新安装也可能会再次获取命名实例的名称。您可以在SQL服务中对此进行验证,以确定它是否仍在使用旧名称。在这种情况下,最好的方法(对我有用)是安装一个具有显式名称MSSQLServer的新实例,该实例已知为默认实例名称。

Keep in mind also that SQL takes the computer name and uses it as an alias.

还要记住SQL获取计算机名称并将其用作别名。