sql-server-agent

SQL 2000 equivalent of SQLAgentReaderRole

I have quite a few developers asking me if certain SQL jobs ran, and I would like to give them access to check it on their own without giving them 'sysadmin' rights. I know that in SQL 2005, you can grant them the SQLAgentReaderRole, but I am looking for a solution in SQL 2000. ...

How to customize sql server agent jobs

I need to be able to schedule a job on the 10th of each month and have it run for a set number of days or until a specified date. Is there any way to customize sql server agent jobs using some sort of API or something? Thanks. ...

Best way to temporarily take app offline during sql agent job

I've got an ASP.NET app that runs against a SQL Server 2005 database. Once a day, I need to run a series of procs & SSIS packages in a SQL Agent job to update data in the tables. The SQL Agent job will run on a schedule unattended. There are small windows of opportunity for the web app to fail when the SQL Agent Job steps are running, ...

Best Place to Store SSIS Sensitive Encrypted Password In a 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 else. I like encrypting with a password. The problem is whenever I setup a job in a step...

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 Server Agent and modify the command text to find+replace a specific piece of text. I ...

How to find SPID of a executing SqlAgent job using SMO

With SMO objects using Server.JobServer.jobs to get a list of jobs, I can find the status of each job. For those that are currently executing I would like to find the SPID it is executing on. I can also get a list of the server's processes using Server.EnumProcesses(). This gives me a list of currently active SPIDs. I want to match th...

sp_start_job wait for job to finish

Is there a way to determine when a sql agent job as finished once it has been started with sp_start_job? ...

What SQL 2000 rights are required for creating SQL Agent jobs?

Hi All, It's been a long while since I looked at SQL Jobs on SQL Server 2000. On SQL 2005, if I want to allow a user to create jobs etc I add the requisite login to msdb and assign one of the roles SQLAgentUserRole, SQLAgentReaderRole or SQLAgentOperatorsRole role. No problem there. Perhaps someone can help me jog my memory about rig...

SQL Server Agent: How to "sleep"?

In a scripting step in a scheduled task in SQL Server Agent 2005, I need to trigger a webscript that is running on a different server. I'm doing this: Dim ie Set ie = CreateObject( "InternetExplorer.Application" ) ie.navigate "...to my dreamscript" ' Wait till IE is ready Do While ie.Busy (1) Loop ie.Quit set ie = Nothing At (...

SQLSTATE 01000 in SQL Server job output

I've got SQL Server jobs running that include periodic 'print' statements so that I can look in the job history and get a sense of what happened. But the output is cluttered with [SQLSTATE 01000]. Given that there is a limit to how much will fit in this output, I'd like as much space as possible for information I care about. Is ther...

SQL Server 2K - Agent Jobs - Errors and Messages

I have a job that runs every night. I do my own logging in my stored procedure so that I can tell what was going on if something fails. Last night the job failed and I know where. When I ran the job manually it succeeded. So I went to the job history to see what I could find. I selected the "Show Step Details" and can see the message...

SQL Server 2005 - Linked Servers & Agent Jobs

I have a strange scenario that I am currently unable to explain. I live in hope that it's just "the Friday feeling" or that some kindly sole here will bail my brain out and save me from endless loops of "but why!?" :) Two servers, running SQL Server 2005, with DNS Entries of: 1. ServerA 2. ServerB (Well, they're not really calle...

Problem using SQL Agent to run SSIS Packages - fails with "DTSER_FAILURE(1)"

I have an SSIS Package stored in the MSDB database which works fine when I execute it. It will run under SA account or will use Windows security. I want to schedule this job to run with SQL Agent, but when I do I get a strange error and whatever configuration I try it fails with the following error: Executed as user: SERVER\SYSTEM. on ...

How to edit the SQL Agent Job from within SSMS 2005?

I am trying to edit or view the SQL Agent's job (I am the owner of this job) from SSMS 2005 and I can't find out how to do this. When I am doubleclicking a job or entering job's properties I get empty "New Job" window. Is there some way to correct this behavior? Thanks ...

Will a SQL Server Job skip a scheduled run if it is already running?

The title pretty much says it all - if you schedule a SQL Server job to run every X number of minutes, and it does not finish the previous call before the # of minutes is up, will it skip the run since it is already running, or will it run two instances of the job doing the same steps? ...

SSIS package not running when called as step in SQL Job

I have a .dtsx file (an SSIS package) that downloads files from an FTP server and imports data. It runs fine whenever I run it manually. However, when I schedule calling the package as a step in a SQL server agent job, it fails. The step it fails at is the one where I call a .bat file. The error in the job history viewer says this: ...

SQL server 2005 agent not working

Sql server 2005 service pack 2 version: 9.00.3042.00 All maintenance plans fail with the same error. The details of the error are:- Execute Maintenance Plan Execute maintenance plan. test7 (Error) Messages Execution failed. See the maintenance plan and SQL Server Agent job history logs for details. The advanced information sect...

SQL Server Job - The system cannot find the file specified

I am running a SQL Server Agent job which zips up my database backups. The application I run is a C# Windows Application which takes in the path of the database as an argument. When I run the application form a command prompt all works well. However when I run it from within a sql server job using the Operating System (CmdExec) as the ty...

Maintenance plan duration shown in history

Hi, Here is an export of our sql 2005 maintenance plan history Date,Source,Severity,Plan Name,SubPlan Name,Task Name,Duration 06/07/2009 05:08:29,,Unknown,Weekly optimisation,Subplan_1,,05:08:25 06/07/2009 05:07:41,,Unknown,,,Shrink Database Task (localhost),00:00:48 06/07/2009 04:50:40,,Unknown,,,Rebuild Index Task (localhost),00:16:4...

how to handle SQL Agent job error?

Hello everyone, I am writing a SQL Agent Job to remove rows from Table 1 and Table 2 once a day. The step of the SQL Agent job is -- delete some specific records from Table1, then delete some specific records from Table 2. My question is, How to record the error during SQL Agent? Any logs/events we could use? (so that we could see in...