在A机器上建立到B机器的DBLINK,然后在A机器上执行:
select top 10 * from B.dbname.dbo,tablename可以执行,
但是执行下面的就报错:
EXEC B.dbname.sys.sp_executesql
N'
select top 10 * from dbname.dbo.tablename
'
报错信息为
Msg 18483, Level 14, State 1, Line 2
Could not connect to server Bbecause 'fis' is not defined as a remote login at the server. Verify that you have specified the correct login name. .
其中B这个DBLINK的映射账户是fis。
最后需要在B实例上建立到A的DBLINK,并且执行:
sp_AddRemoteLogin 'A','fis'
之后,再次执行报错的语句即恢复正常了。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16754036/viewspace-705318/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/16754036/viewspace-705318/