How to run a Job from a Stored Procedure in another server?

点点圈 提交于 2019-12-06 00:03:05

So why not consider using

exec LINKEDSERVERNAME.msdb.dbo.sp_start_job 'Job Name'

?

(didn't test it though, maybe some-unseen-answer was the same, but erased as incorrect and not working)

There must be enough privileges for linked-server-login to run the job, of course - at least it has to be job's owner.

Yep, you can use the evil that is osql:

osql -S "Remote Server" -E -Q"exec msdb.dbo.sp_start_job 'Job Name'"

(Where -E denotes using a trusted connection, you can also specify credentials using alternative osql syntax)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!