Questions tagged [sql-server-agent]

SQL Server Agent is a Microsoft Windows service that executes scheduled administrative tasks, which are called jobs. SQL Server Agent uses SQL Server to store job information. Jobs contain one or more job steps. Each step contains its own task, for example, backing up a database. SQL Server Agent can run a job on a schedule, in response to a specific event, or on demand.

From Microsoft.com:

SQL Server Agent is a Microsoft Windows service that executes scheduled administrative tasks, which are called jobs. SQL Server Agent uses SQL Server to store job information. Jobs contain one or more job steps. Each step contains its own task, for example, backing up a database. SQL Server Agent can run a job on a schedule, in response to a specific event, or on demand.

483 questions
7
votes
5 answers

sp_start_job wait for job to finish

Possible Duplicate: Executing SQL Server Agent Job from a stored procedure and returning job result Is there a way to determine when a sql agent job as finished once it has been started with sp_start_job?
Greg Dean
  • 29,221
  • 14
  • 67
  • 78
6
votes
1 answer

Sql Server Agent job running longer than interval between executions

I would like to know what happens if an agent job (with recurring interval) in MS SQL server runs long enough so that it overlaps recurring execution. According to my tests, paralleled execution does not happen, which is good. What I'm trying t find…
To Ka
  • 640
  • 8
  • 24
6
votes
3 answers

The EXECUTE permission was denied on the object 'sp_sqlagent_update_agent_xps', database 'msdb', schema 'dbo'. [SQLSTATE 42000] (Error 229)

I have installed SQL Server 2016 Express edition and also installed SSMS 18.4, now I am having an issue while restarting the SQL Server Agent service. I am able to login with my system user, but not able to login with the default user name like:…
Mahesh S
  • 373
  • 1
  • 3
  • 19
6
votes
1 answer

SQL Server (SQLEXPRESS) and SQL Server Agent (SQLEXPRESS)

I came across these two services separately running in Services.msc - SQL Server (SQLEXPRESS) - started+Automatic SQL Server Agent (SQLEXPRESS) - Disabled Can you please guide why do we need SQL Server Agent (SQLEXPRESS)? Thank you!
inutan
  • 10,558
  • 27
  • 84
  • 126
6
votes
2 answers

How to bulk-amend the job step command in ALL sql server agent jobs

I have many jobs that have a step to send 1 specific email out to a list of people. That list of reciepients is hardcoded in the step command and I need to remove one person from that list, in all jobs. How do I loop through ALL the jobs in the Sql…
HAdes
  • 16,713
  • 22
  • 58
  • 74
6
votes
2 answers

SQL server agent not reporting failure from uncaught exception in PowerShell script

I have set up an SQL server agent job with a few steps that needs to be processed each week. One of which is a PowerShell script that will throw the following (uncaught) custom exception: $endfile = Test-Path "C:\Temp\1_${loc}_${lastpayweek}.csv" IF…
6
votes
3 answers

Looking for T-SQL scripts to delete a SQL Job

If I know the database server name, instance name and the SQL Server job name, how to delete a SQL Server job by its name in a simple way? I am writing scripts which will be called by sqlcmd to delete SQL jobs. Appreciate if anyone could show me a…
George2
  • 44,761
  • 110
  • 317
  • 455
6
votes
5 answers

unable to kill SQL server job, status stays killed/rollback

I am unable to kill some SQL Server agent jobs. The task state continues to be running and the command stays in KILLED/ROLLBACK. The job executes queries against OSI's PI system via OLEDB linked server and Oracle. The only way I have found so far to…
Ahd
  • 271
  • 2
  • 3
  • 7
6
votes
1 answer

SQL Server Jobs / Schedules - US vs. UK Daylight Savings Adjustment

SQL Server Jobs / Schedules - US vs. UK Daylight Savings Adjustment We have a UK based server which needs to run a SQL Agent Job at 16:30 (US Central time – this may seem strange but it because of the availability of some data). Usually this…
Adrian S
  • 1,007
  • 4
  • 12
  • 26
5
votes
3 answers

Where do I store sensitive encrypted password in an SQL Server agent job?

I prefer to keep our SSIS packages in a solution on the server, not in sql. By default, sensitive data is encrypted with a user key. Since the sql server agent uses a service account to run jobs, we have to change this encryption method to something…
K Richard
  • 1,924
  • 2
  • 22
  • 43
5
votes
8 answers

SQL Server Agent - SSIS Package - Error 0x80131904 - Timeout expired

There's been a string of random occurrences of the following error in the SQL Server Agent scheduled jobs lately that I have been unable to find a solution to. The error occurs infrequently, but usually once a week for a daily scheduled job, but…
Ryan
  • 113
  • 1
  • 2
  • 11
5
votes
6 answers

Access Denied error when running job in SQL Server Agent

I am trying to get SQL Server Agent to run a program with arguments (as a Operating system CmdExec job step), but everytime it runs the job I receive the following error: The process could not be created for Step 1 of job, reason: Access is denied).…
Him_Jalpert
  • 2,476
  • 9
  • 31
  • 55
5
votes
4 answers

TRY/CATCH does not work on SQL Server Agent error?

I use sp_start_job to start a job. The job (test2) has only one step: select getdate() waitfor delay '00:00:10' The TRY/CATCH code: begin try EXEC msdb.dbo.sp_start_job @job_name = 'test2' end try begin catch print 'error' end catch First…
thotwielder
  • 1,563
  • 7
  • 44
  • 83
5
votes
3 answers

Can I install SQL Server Agent, but no database instance?

Can one install Microsoft's SQL Server Agent, without a database instance? (The aim is to reduce traffic to the database. I would like to put the server agent to an other server.) Thanks for the help.
Sziro
  • 1,273
  • 1
  • 13
  • 21
4
votes
2 answers

How can I manage SQL Server jobs using a Database project

Does Visual Studio 2010 support managing SQL Server jobs in the Database Project? I am working with a database project in Visual Studio 2010. I would like to manage my database scheduler job in my database project. It seems that I could not create…
1 2
3
32 33