SQL Server Agent Job cannot kill a task on a machine - sql-server

I have SSIS package which starts a task and then kills it via cmd. This works when executed directly from Visual Studio. However, task is not killed when SQL Server Agent executes a job with this package. Job has proxy with a user.
I created a separate CmdExec job with this proxy and taskkill command but it throws "Access denied" error. Proxy is the same as the user that started the task on that machine.
How to kill a process on a server machine?

Related

SQL Server Agent Job will not complete, no indication job even started, no error messages

Agent in SQL Server 2016, running on Server 2014.
SSIS project developed in VS 2015, runs as expected. Single node executes simple SQL.
Package is deployed via DeploymentManifest, deployed to ‘SQL Server’. Deployed package runs as expected when started in Integration Services > Deployed Packages > MSDB
Have created Credential and Proxy, no changes to problem, no error messages, nothing logged.
Run without Credential and Proxy, same outcome.
Package Security ProtectionLevel is EncryptSensitiveWithPassword, have tried other ProtectionLevels with same outcome.
It appears that nothing is even beginning to execute, no error messages, no completion. How to check that package is actually deployed and agent can access?
I stopped the service that runs agent jobs: "SQL Server Agent". Restarted it with a different logon, a logon that is used to build and deploy the ssis project. Restarted the service. The original service was run under the "NT Service\SQLSERVERAGENT" account , which seems to be a default account.

What is the proper way of running access macro from sql server agent job scheduler

I have requirement of automating the process of running macros to fill sql tables. I am using a sql server job scheduling agent for this. Here is my macros batch file:
"C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE" "C:\Users\stiwari\Documents\access_table.accdb" /x upload
These commands work when executed as a batch file from command prompt and the data moves to SQL db. They also work when executed in windows task scheduler. However this syntax doesn't work when using a cmd job task in SQL server.
I have even enabled proxy credentials still it doesn't work.
I get this error all the time:
The step didn't generate any output. Process Exit Code-1073741502. The step failed.
What can be the reason?

execute sql server agent job task in ssis error : Failed to lock variable"RunIs" for read access with error 0xC0010001

I am using SQL Server 2016 and SSIS. I have a package in which I am calling a sql server job.
My job have just one step as PowerShell command for transfering all files from one directory to another directory between two servers.
When I run my job from SQL server, it works well.
When I run my package from VisualStudio, every things is ok, but after deploying my project to sql server, when I want to run this package from SQL Server, I have this error :
Execute SQL Server Agent Job Task: Error: Failed to lock variable "RunId" for read access with error 0xC0010001 "The variable cannot be found. This occures when an attempt is made to retrive a variable from the Variable collection on a container during execution of package, and the variable is not there. The variable name may have changed or the variable is not being created.".
I deleted the Execute sql server agent job task from my package and I redeployed my project and now I do't have this error. It is clear that error is about Execute sql server agent job task.
I have more than 2000 files in source directory and it takes several minutes to transfer all files to destination directory.
Edit1 : I have several Task and component in my package and the last ones is Execute sql server agent job task and i don't have Execute T-SQL Statement Task.

Execute SSIS package is not working with SQL Agent

I post this question to the other forums too but still cannot find any solution.
I create SSIS package to send file to SFTP server. It works fine when I execute the package with in the SSIS.
But when I tried to run via SQL agent it keeps on running without sending the file until I stops the job by force.
I add the proxy account too but no solution.
My script to run the package is
option batch on
option confirm off
open sftp://UserName:Password#SFTP server Name :22001 -timeout=240
cd ToAA
option transfer binary
put C:\test29022016.csv
mget *.csv
Exit WinSCP
close
exit
Kindly help to solve this issue
Attached find the SSIS package details:
SQL server credentials:
SQL Process Keeps on Running:
SQL Job:
SQL Credentials:
The only difference between you running the package manually, and the SQL Agent running it as a job, is the account that is running the package. In the first case it is your account, and in the second case, it is the SQL Agent's account.
So if it works in the first case, and not the other, then the problem is that the SQL Agent lacks some permission that you have.
Have your network/security administrator give the SQL Agent all the same permissions you have and it will work.
To find out exactly what permission is missing, try logging into your computer as the SQL Agent's account, and run the package in Visual Studio, and see what error message occurs.
I found a work around and I am using windows task scheduler with the help of batch file to run SSIS.

SQL Server Agent job not running package

I have an SSIS package that I have deployed to the file system. The owner for the package is my Windows Login. The reason for this is that it needs to write files to another server. If I make the owner NT SERVICE\SQLSERVERAGENT the error that I get is that the files on the remote server cannot be accessed.
The package itself runs under my account. The package normally takes about 5 minutes to run and works when run directly (double click, click Execute and enter decryption password). I can tell the package has run because it writes a number of logs to the file system.
I've set up a SQL Server job to run the package. The job says it's run successfully but there are no logs being written. I'm not sure where I've gone astray other than there's some account that I'm likely missing.
Has anyone else ever run into this?
The issue was that I needed to set up a proxy Account to run the SQL Server agent.

Resources