0

I'm getting "Msg 18456, Level 14, State 1, Line 1 Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'." from when trying to execute the code below. I've change all of the critical information, but you should get the idea.

Are some of my parameter incorrect? The local sql admin username is correct and the remote username and password is correct, but it still keeps telling me that the login failed. Any ideas?

Overall, are there other changes I need to make? Can I insert data this way?

Both DBs are sql server 2005. One is local, one is offsite and accessible via a secure vpn tunnel. I have no trouble acessing the offsite DB using SSMS using the username and password i've been provided(those i've been using in my SP).

-- establish the linked server and login.   
EXEC sp_addlinkedserver   @server=SERVER1,@srvproduct='',@provider='SQLNCLI', @datasrc='SERVER IP ADDRESS'

EXEC sp_addlinkedsrvlogin SERVER1, 'false', 'LOCAL SQL ADMIN USERNAME', 'REMOTE USERNAME', 'REMOTE PASSWORD'

insert into [SERVER1].DATABASE.dbo.INSERTTABLE(....) select fields from localtable

-- drop the linked server and login
EXEC Sp_DropServer SERVER1, 'droplogins'
4

3 回答 3

1

我怀疑目标服务器仅设置为“Windows 身份验证”。

当您尝试作为 SQL 登录名(在 sp_addlinkedsrvlogin 中指定)进行连接时,它会尝试将凭据解释为 windows 并失败

当 sp_addlinkedsrvlogin 的 @useself = 'true' 并且调用 SQL Server 未配置为委派时,通常会发生此错误。服务器(不是 SQL 服务器)无法通过 Windows 凭据。

于 2009-07-19T07:55:55.713 回答
0

1) 为 sp_addlinkedsrvlogin 使用命名参数以获得明确性。

2)在语句之间使用“go”(不要将上述作为单个批处理执行)。

3) 将“本地 sql 管理员用户名”设置为 null - 以排除这种情况

4)请注意,远程用户名/密码(如果指定)似乎需要是 sql-server 登录,而不是 NT 网络登录

从那些开始……!

于 2009-07-14T16:57:53.303 回答
0

不确定确切原因的人。我刚刚通过 SSMS GUI 移动了一个创建的链接服务器。

于 2009-07-22T21:01:11.973 回答