How to run a Job from a Stored Procedure in another server?
Is it possible to run 开发者_Python百科a Job from a stored procedure located in a different server? If so, how?
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)
精彩评论