链接服务器在SQL Server作业上失败 [英] Linked Server failing on SQL Server job

查看:86
本文介绍了链接服务器在SQL Server作业上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个链接服务器,可以在执行查询时完美地工作.但是,当我将查询放在工作中时,它会失败.

I have a linked server that perfectly works when executing a query. But when I place the query in a job, it fails.

这是我的链接服务器的设置

Here is the setting of my linked server

错误

推荐答案

阅读 SQL Server代理当作业使用链接服务器时,作业将失败.

解决方法要变通解决此问题,请使用以下方法之一 方法:

WORKAROUND To work around this problem, use one of the following methods:

方法1

让系统管理员成为工作的所有者.

方法2:

为链接服务器使用映射的安全上下文并修改作业 作为OSQL运行.

Use mapped security context for the linked server and modify the job to run as OSQL.

要为链接服务器设置映射的安全上下文,请执行以下操作:右键单击 链接的服务器,然后单击属性.单击安全选项卡. 选择以下任一选项.使用登录名 当前安全上下文使用此安全上下文进行修改 以OSQL形式运行的作业:右键单击该作业,然后单击确定". 特性.在步骤"选项卡中,单击要设置的步骤名称". 编辑,然后单击编辑.在编辑作业"步骤的常规"选项卡上 对话框中,在类型列表中单击操作系统命令(CmdExec). 在命令文本框中,键入osql –E –Q"ExecstoredProcedure".在编辑中 在作业步骤"对话框中,单击确定".在属性"对话框中,单击确定".

To set the mapped security context for the linked server: Right-click the linked server, and then click Properties. Click the Security tab. Select either of the following options. Be made using the login's current security context Be made using this security context To modify the job to run as OSQL: Right-click the job, and then click Properties. In the Steps tab, click the Step Name that you want to edit, and then click Edit. On the General tab of the Edit Job Step dialog box, click Operating System Command (CmdExec) in the Type list. In the Command text box, type osql –E –Q "Exec storedProcedure". In the Edit Job Step dialog box, click OK. In the Properties dialog box, click OK.

在链接服务器定义中打勾: Be made using the login's current security context

In linked server definition tick: Be made using the login's current security context

这篇关于链接服务器在SQL Server作业上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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