Skip to main content

Questions tagged [jobs]

A scheduled task managed by the database, for example using SQL Server Agent, Oracle dbms_job, or MySQL Event Scheduler.

Filter by
Sorted by
Tagged with
12 votes
1 answer
31k views

Allow non-sysadmin, non-owner of a SQL Server Agent job to execute it

I have a job that runs an SSIS package. Currently the owner is a proxy account. I can run the job manually from a sys-admin account. Our web service logs in using a limited account. It needs to ...
Cruncher's user avatar
  • 223
9 votes
2 answers
7k views

Error running Powershell Script in SQL Server Agent

I have a SQL job that runs via SQL Server Agent (Running SQL Server 2012 Enterprise). The last step of the job is to run an application located on a network share. Unfortunately I don't know the name ...
Greg's user avatar
  • 3,262
21 votes
7 answers
187k views

Script to see running jobs in SQL Server with Job Start Time

how to write script to see running jobs in SQL Server with Job Start Time? SELECT sj.name, sja.run_requested_date, CONVERT(VARCHAR(12), sja.stop_execution_date-sja.start_execution_date, 114) ...
zerbug's user avatar
  • 329
21 votes
4 answers
90k views

What is the Query to display the failed sql jobs

What is the Query to display the failed sql jobs,so that I can get all the failed job information with one query
Avi's user avatar
  • 327
9 votes
2 answers
6k views

How to schedule jobs in Sql server 2008 for less than 10 sec?

I want to run a job every 3 seconds, however in SQL Server 2008 we cannot define an interval of less than 10 seconds. The job is used to insert/update visitor information, and segmentation ...
Musakkhir Sayyed's user avatar
3 votes
1 answer
29k views

How to run SQL Job only on primary replica in AlwaysOn Availability Groups? [duplicate]

I have SQL Jobs that need to only on primary replica on AlwaysOn Availability Group. When jobs were originally created ServerA was primary, at later point ServerB became primary so jobs that were on ...
Vladimir Oselsky's user avatar
-5 votes
1 answer
2k views

Declare variable to hold job name and if job running kill it

I’m looking for a single file that does these things in order. Declare a variable to hold a job name Run a query to check whether that job declared is currently running Set up an if loop If the job ...
LeraningDBA's user avatar
8 votes
1 answer
11k views

SQL Server Agent logging actions and changes done to jobs

Is there a way to track changes done to SQL Server Agent jobs? If you had a reason to believe somebody is playing around with your job settings. How would you proceed to track who did it and from ...
Peter's user avatar
  • 151
4 votes
2 answers
12k views

Cannot give NT SERVICE\MSSQLSERVER permissions on network drive

I have an SSIS package that I would like to run as a job. The flat file source sits on Server A while the package and job sit on Server B. When I run the job that executes the SSIS package I get an ...
Cody Francis's user avatar
3 votes
1 answer
600 views

How to get the AD account associated to a Proxy?

on the picture below, you can see, I have a sql server job called "Backup SSAS DBS_" that Run as: PowerShell_Proxy How can I find out the AD (active directory) account associated with that Proxy via ...
Marcello Miorelli's user avatar
0 votes
1 answer
1k views

CmdExec Powershell Job Step Escape Double Quotes

I have a PowerShell job step I'm trying to execute and it's failing with a syntax error I believe is because I'm trying to escape double-quotes in my code. Can anyone take a look and help me with ...
JonDBA5420's user avatar
67 votes
4 answers
147k views

How to run recurring tasks on Postgresql without an external cron-like tool?

I would like to call a stored procedure on a regular basis. On Oracle, I would create a job for this. I have found that Postgresql can mimic this well by using an external tool (cron etc) and PgAgent. ...
Stephan's user avatar
  • 1,463
25 votes
4 answers
104k views

Grant permissions to run a SQL Server job

I have a job on my SQL Server 2005 instance that I want to allow any database user to run. I'm not worried about security, since the input to the job's actual work comes from a database table. Just ...
Shahar Mosek's user avatar
12 votes
2 answers
60k views

deleting large volumes of rows from table efficiently in SQL Server [duplicate]

I have a table that has gotten a little out of control. I am not a DBA per se but seem to recall that deleting a huge volume of rows in one shot can cause transaction log issues, hamper overall system ...
JoeGeeky's user avatar
  • 1,267
9 votes
2 answers
15k views

Transaction and Try-catch in SQL Server Job

We have DML operations in each step of a SQL Server job. To ensure the update/insert will be rolled back in case something goes wrong, I have wrapped the data modifications of each step in TRY CATCH ...
Sky's user avatar
  • 3,684
8 votes
1 answer
2k views

How do I ensure only one instance of a job is running?

SQL Server 2014 Standard Edition. We have a job that runs from 20-40 min. We only want one instance of this job running, but we don't want huge gaps between runs. So, scheduling it every 60 min is ...
Jonesome Reinstate Monica's user avatar
8 votes
2 answers
15k views

How do you get an average of job history times?

The following is a script I found online that has most of the elements of what I desire in the result set. The only thing missing is how I can get an average of the run times over a decided time ...
AKDiscer's user avatar
  • 1,385
4 votes
2 answers
5k views

Automated SP_WhoIsActive SQL Activity Capturing Issue

I have an SQL Agent Job on a production server that keeps failing with the below messages. It is supposed to be capturing SQL Server activity using the SP_WHOISACTIVE stored proc, at regularly ...
LeraningDBA's user avatar
4 votes
1 answer
578 views

Creative workaround for granting edit rights to individual jobs for a group?

We have two developers that say they can not function without full rights to a few jobs on our database server. They both want rights to the same jobs. Given that it seems that MS doesn't seem to be ...
Cate Donoghue's user avatar
4 votes
2 answers
2k views

Targeting MSX with job on Multi-Server Administration

I am using Multi-Server Administration to execute jobs on multiple targets. This works well, but I am not able to enlist the master as a target. I receive the following error when attempting to enlist ...
Dustin Laine's user avatar
3 votes
1 answer
2k views

Oracle Jobs: Can I create a job that will not overlap with itself?

How can I ensure that a job will never have more than one instance running? For example, if I have a job that is scheduled to run once a minute, but it actually runs for three minutes, I don't want a ...
Mark Harrison's user avatar
3 votes
1 answer
4k views

Restoring Job failed with error 'Could not find a log backup file that could be applied' on Log Shipping in SQL Server (Secondary)?

Recently I configured Log shipping between 2 different servers (all SQL Server 2008 R2), from primary to secondary (2 instances). Log shipping configured successfully and databases on secondary ...
CR241's user avatar
  • 1,495
3 votes
1 answer
6k views

Get Job step run for all jobs and job steps using TSQL

I was wondering if there is an easy way to check the "Run as" value for each job step using TSQL code instead of opening every job on the server and each individual step? I cannot figure out where to ...
Joachim Prinsloo's user avatar
2 votes
2 answers
1k views

Can't take backup to the shared folder

Need your help. My sql job is not able to take backup to the shared folder although the domain account, under which the sql agent service account is running, has full permission on that shared folder. ...
Rauf Asadov's user avatar
  • 1,273
2 votes
1 answer
6k views

How to add a step in all existing jobs in sql server

IF (SELECT ars.role_desc FROM sys.dm_hadr_availability_replica_states ars INNER JOIN sys.availability_groups ag ON ars.group_id = ag.group_id AND ars.is_local = 1) <> 'PRIMARY' ...
Uday's user avatar
  • 29
2 votes
1 answer
5k views

SQL Server Agent cannot log on to "MyServer"

I'm struggling to get our SQL Server Agent to run a maintenance plan, which used to work in the past. (This is on SQL Server 2008 R2.) The original problem was that the SQL Server Agent would not ...
Peet Brits's user avatar
2 votes
3 answers
9k views

SQL Server Agent: QUOTED_IDENTIFIER

The scenario is rather simple: A Job fails in production, giving off an error "ALTER INDEX failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER' ...". The question is, ...
Kahn's user avatar
  • 1,813
1 vote
1 answer
4k views

how to calculate the next time a job will run - by each schedule

I have a script that shows me when it is the next time a job(s) will run, and other things, the dates are formatted, etc. the script is here, and it works fine: USE msdb Go set transaction ...
Marcello Miorelli's user avatar
1 vote
2 answers
14k views

Job showing the running sign but not currently running

I have a script to get the currently running jobs: -- get the running jobs --marcelo miorelli -- 10-dec-2013 SELECT sj.name ,DATEDIFF(SECOND,aj.start_execution_date,GetDate()) AS Seconds FROM msdb.....
Marcello Miorelli's user avatar
1 vote
4 answers
687 views

replace all references to a drive inside the jobs to another drive

I have a server where all my sql server backups are currently being saved to the G: drive. Now there is no enough disk space on drive G: to keep backups for the last 5 days. I have asked to add ...
Marcello Miorelli's user avatar
0 votes
1 answer
454 views

SQL Server Agent 2012 Job Schedule Report [closed]

I am looking for a report that will display graphically what jobs are scheduled on the server and when. My goal is to very quickly be able to glance at it and find a time where a new job will not ...
BSmith's user avatar
  • 11
0 votes
1 answer
534 views

Log shipping - Job schedules

When we configure the Log Shipping, there are jobs automatically created that run on schedule. What happens if db size grows or there is network latency, does SQL Server auto handle the job schedules? ...
variable's user avatar
  • 3,568
0 votes
1 answer
2k views

Why do we need to use proxies for syadmin job steps?

I read somewhere that for non-TSQL SQL Server Agent jobs, the job runs under SQL Server Service Agent account when the job owner is the sysadmin. I just don't get why we need to use proxies even the ...
Mulie's user avatar
  • 1