问题
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 :
- Create a SSIS job to run the 5 stored procedures in parallel.
- 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