We have a hosted server that is named, by the hosting company, as something like WinEnt99. We would like to rename it to something more meaning like OurMonitor1.
我们有一个托管服务器,由托管公司命名为WinEnt99。我们想将它重命名为更像OurMonitor1的东西。
We have already installed a few instances of SQL Server 2008 R2.
我们已经安装了几个SQL Server 2008 R2实例。
Is there anything that we need to (re)configure in SQL Server / SSMS ?
在SQL Server / SSMS中是否需要(重新)配置?
I have an application that was reading the database settings from the registry, and connecting the database fine. Now, it won't connect to the database. The only thing that I can think of is that we renamed the server last week sometime.
我有一个应用程序正在从注册表中读取数据库设置,并正确连接数据库。现在,它将无法连接到数据库。我能想到的唯一一件事就是上周我们重命名了服务器。
EDIT 02 Oct 2012:- The Server is being renamed. The named instances are not.
编辑2012年10月2日: - 服务器正在重命名。命名实例不是。
I've run
sp_helpserver
select @@servername
Which showed the old server name, and
其中显示了旧的服务器名称,以及
sp_dropserver 'Old Server Name\Instance_name'
go
sp_addserver 'New Server Name\Instance Name','local'
go
Then confirmed the details in
然后确认了细节
sp_helpserver
select @@servername
2 个解决方案
#1
8
First collect the output of the current instance configuration. You can get the instance name stored in the SQL Server metadata.
首先收集当前实例配置的输出。您可以获取存储在SQL Server元数据中的实例名称。
Make sure you have backup of all the database if you are changing the production server instance name.
如果要更改生产服务器实例名称,请确保备份所有数据库。
sp_helpserver
select @@servername
You can change the instance name using below query. Default Instance
您可以使用以下查询更改实例名称。默认实例
sp_dropserver 'old_name'
go
sp_addserver 'new_name','local'
go
Named Instance
sp_dropserver 'Server Name\old_Instance_name'
go
sp_addserver 'ServerName\New Instance Name','local'
go
Verify sql server instance configuration by running below queries
通过运行以下查询来验证sql server实例配置
sp_helpserver
select @@servername
Restart the SQL Server Services.
重新启动SQL Server服务。
net stop MSSQLServer
net start MSSQLServer
[Update]
You cannot change connection instance name as this action is not supported. Only option is re-install SQL server. See answer in MSDN here
您无法更改连接实例名称,因为不支持此操作。只有选项是重新安装SQL Server。请在MSDN中查看答案
#2
1
There is no command to rename an instance. You will need to create a new instance side by side, move the databases by whichever method you'd like (backup & restore would be fine) and drop the previous instance.
没有命令重命名实例。您需要并排创建一个新实例,按照您想要的任何方法移动数据库(备份和恢复都没问题)并删除前一个实例。
sp_addserver "OurMonitor1" , local
sp_dropserver "WinEnt99"
#1
8
First collect the output of the current instance configuration. You can get the instance name stored in the SQL Server metadata.
首先收集当前实例配置的输出。您可以获取存储在SQL Server元数据中的实例名称。
Make sure you have backup of all the database if you are changing the production server instance name.
如果要更改生产服务器实例名称,请确保备份所有数据库。
sp_helpserver
select @@servername
You can change the instance name using below query. Default Instance
您可以使用以下查询更改实例名称。默认实例
sp_dropserver 'old_name'
go
sp_addserver 'new_name','local'
go
Named Instance
sp_dropserver 'Server Name\old_Instance_name'
go
sp_addserver 'ServerName\New Instance Name','local'
go
Verify sql server instance configuration by running below queries
通过运行以下查询来验证sql server实例配置
sp_helpserver
select @@servername
Restart the SQL Server Services.
重新启动SQL Server服务。
net stop MSSQLServer
net start MSSQLServer
[Update]
You cannot change connection instance name as this action is not supported. Only option is re-install SQL server. See answer in MSDN here
您无法更改连接实例名称,因为不支持此操作。只有选项是重新安装SQL Server。请在MSDN中查看答案
#2
1
There is no command to rename an instance. You will need to create a new instance side by side, move the databases by whichever method you'd like (backup & restore would be fine) and drop the previous instance.
没有命令重命名实例。您需要并排创建一个新实例,按照您想要的任何方法移动数据库(备份和恢复都没问题)并删除前一个实例。
sp_addserver "OurMonitor1" , local
sp_dropserver "WinEnt99"