Posts

Showing posts from February, 2016

T-sql procedure to wait for sql server agent job

/*   Awaits job to finish, then returns job_status   0 = Failed   1 = Succeeded   2 = Retry   3 = Canceled   null = Job never executed / no history   If job was executed and already finished successfully before this proc starts, it will return 1 (success) */   create   procedure   tools . AwaitSqlServerAgentJob      @jobName   sysname   as      declare   @jobid   uniqueidentifier   =   ( select   job_id   from   msdb . dbo . sysjobs   where   name   =   @jobname   )    declare   @sessionId   int   =   ( select   max ( session_id )   from   msdb . dbo . sysjobactivity ...

Solution: Stopping SSIS package causing "Unable to terminate process (reason: Access is denied)"

I had big problems finding the solution to the message [Job Name]:  Unable to terminate process  [pid]  launched by step  [x]  of job  [guid]  (reason: Access is denied). that fired when trying to stop Sql server agent jobs running step type "SQL Server Integration Services Package" Some suggested changing the job owner to sa or troubleshooting access. These suggestions did not fix it in my environment. Fix Change Step type from "SQL Server Integration Services Package" to "Operating System Command", and execute dtexec manually like so: dtexec /FILE "\"\\your file path.dtsx\"" /CHECKPOINTING OFF /REPORTING E The options are not relevant for my scenario, it was the type: Operating System Command that fixed it.