sp_dropserver 和 sp_addserver 不工作 [英] sp_dropserver and sp_addserver not working

查看:39
本文介绍了sp_dropserver 和 sp_addserver 不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 SQL Server Express 2008 R2,我想将实例名称从机器名称"\SQLEXPRESS2008R2 更改为机器名称".我跑了:

I am using SQL Server Express 2008 R2 and I wanted to change the instance name from "machine name"\SQLEXPRESS2008R2 to just "machine name". I ran:

sp_dropserver 'old_name'

go

sp_addserver 'new_name', 'local'

go

然后重新启动 SQL 服务.现在当我看

Then restarted the SQL Service. Now when I look at

Select @@SERVERNAME --this is correct

但这不正确吗?

Select serverproperty('ServerName') --This still shows old name

所以当我尝试通过 SSMS 连接到我的实例时,我仍然必须使用旧实例名称而不是我刚刚应用的新实例名称进行连接?我究竟做错了什么?为什么不采用新名称?

So when I try to connect to my instance via SSMS I still have to connect using the old instance name isntead of the new on I just applied? What am I doing wrong? Why is the new name not taking?

谢谢,

S

推荐答案

这是来自在线书籍:

虽然@@SERVERNAME 函数和 SERVERPROPERTY 函数的 SERVERNAME 属性可能返回格式相似的字符串,但信息可能不同.SERVERNAME 属性会自动报告计算机网络名称的变化.

Although the @@SERVERNAME function and the SERVERNAME property of SERVERPROPERTY function may return strings with similar formats, the information can be different. The SERVERNAME property automatically reports changes in the network name of the computer.

相反,@@SERVERNAME 不报告此类更改.@@SERVERNAME 报告使用 sp_addserver 或 sp_dropserver 存储过程对本地服务器名称所做的更改.

In contrast, @@SERVERNAME does not report such changes. @@SERVERNAME reports changes made to the local server name using the sp_addserver or sp_dropserver stored procedure.

第一个评论是正确的.您必须重新安装 SQL 才能将其更改为默认实例.

And the first comment is correct. You'd have to reinstall SQL in order to change it to a default instance.

每个 BOL 如果您使用命名实例更改机器名称,则必须按如下方式使用:

per BOL if you change the machine name with a named instances you have to use as follows:

sp_dropserver <'old_name\instancename'>
GO
sp_addserver <'new_name\instancename'>, local
GO

这篇关于sp_dropserver 和 sp_addserver 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆