Parallel execution of stored procedures in job (SQL Server)

喜你入骨 提交于 2019-12-01 10:13:27

问题


Breif: I have five stored procedures and each of it have no dependencies. The identical stuff is that it pulling data from five different servers. We are just collating and feeding it to our server.

Question: We have scheduled all these five in single job with 5 different steps. I want to execute it in parallel instead of sequential order.

Extra: I can actually collate all five stored procs in to one if its possible to run it in parallel in sp level (if not possible in job level).

Thanks


回答1:


There are several options. 2 of which are :

  1. Create a SSIS job to run the 5 stored procedures in parallel.
  2. Create 5 different SQL Server Agent jobs scheduled at the same time



回答2:


The job steps are always executed in succession (hence 'steps').

To parallelize it, create five jobs with the same schedule.




回答3:


It's also possible to create a main job and add steps to call child jobs (each calling it's own stored procedure) asynchronously as suggested at https://dba.stackexchange.com/questions/31104/calling-a-sql-server-job-within-another-job/31105#31105

However for more complicated flow it's better to use SSIS packages which are design to handle different workflows.



来源:https://stackoverflow.com/questions/23150109/parallel-execution-of-stored-procedures-in-job-sql-server

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