Linked Server failing on SQL Server job

后端 未结 2 617
迷失自我
迷失自我 2021-01-19 01:50

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

相关标签:
2条回答
  • 2021-01-19 02:06

    I had this same issue, And after changing user permissions etc etc etc, I found this article and instead of using "Be made using the login's current security context" i used "Be made using this security context" and i specified the account and password which solved the issue. So the issue isnt with SQL jobs or my procedure it was in actual fact my linked server. Even though the link server did work... When calling a linked server within a SQL job the linked server had to have the account details specifically specified.

    0 讨论(0)
  • 2021-01-19 02:20

    Read SQL Server Agent job fails when the job uses a linked server.

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

    Method 1

    Make the system administrator the owner of the job.

    Method2:

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

    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.

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

    0 讨论(0)
提交回复
热议问题