I have scheduled an SQL Job to run every 15 mins. This runs an SSIS package. But sometimes my package might execute for more than 15 mins. In this case, a second instance of the package would start. I don't want this to happen. So is there any way I can check whether the package is already running before I continue the execution of the same. Right now I am using a mutex to handle this problem. Are there any problems using the mutex and is there a better way to handle this?
Thanks in advance.
Sumesh
have you tried using the sql server profiler?|||Actually the entire process is an automated process. I want my SSIS or the SQL job to check whether an instance it has initiated earlier is not running when the next instance has to be started.|||Interesting problem. There is no way that I know of to check whether a package is already executing or not. A good way of getting around this is to disable the Agent job at the start of the package and then re-enable it again at the end. I would probably do this even if I *could* check if a package was running or not.
-Jamie
|||Thank you Jamie! But if I disable the job and then re-enable it after the execution of my package, won't the agent wait for another 15 mins before it starts the next execution of the package?|||i recently heard in an msdn webcast that package execution can be monitored in the sql server management studio object explorer, but i haven't tried this.|||
Hi Sumesh,
I think you could use a scripting task and SMO to extract the current run status of the job:
http://msdn2.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.agent.job.currentrunstatus.aspx
cheers,
Markus
No comments:
Post a Comment