计算机名修改后,SQL Server 服务器名称 与 计算机名不一致。
1. 检查SQL Server 的服务器名称
use master
go
select @@servername
select serverproperty('servername')
2.删除所有之前配置的publishers('old_server_name'为之前的服务名)
select * from msdb.dbo.MSdistpublishers
DELETE FROM msdb.dbo.MSdistpublishers
select * from msdb.dbo.MSdistpublishers
exec sp_droplinkedsrvlogin 'old_server_name',null
exec sp_dropserver 'old_server_name', 'droplogins'
执行完后,重启SQL Server服务
3.配置计算机名与服务名一致
USE master
GO
if serverproperty('servername') <> @@servername
begin
declare @server sysname
set @server = @@servername
exec sp_dropserver @server = @server
set @server = cast(serverproperty('servername') as sysname)
exec sp_addserver @server = @server , @local = 'LOCAL'
end
4.查看服务名
sp_helpserver