sql-server-agent

SQL Agent Job - Connection may not be configured correctly or you may not have the right permissions on this connection?

I'm getting this error when running an SSIS package through SQL Agent Failed to acquire connection "ORACLE ADO.NET". Connection may not be configured correctly or you may not have the right permissions on this connection. When I log on as the SQL Agent User and run the ssis package directly it is fine. When I then execute it through the...

Can only connect to SQL Sever 2008 Express remotely afer server restart

I am running SQL Server 2008 Express and can connect to it fine using port forwarding through my router, AND when I am on the same subnet. However when I am on a different subnet, I can only connect to it right after I restart the SQL Server Agent. After the restart, I can connect to it, however if I close the connection, I have to res...

SQL Agent not kicking off an SSIS package

I have a server that has a SQL Agent job setup to run a two part datawarehouse build and Analysis Services cube build. The job ran successfully until there was a problem with Management Studio and .NET framework 2.0 SP1 was re-installed. The first step in the SQL Agent job is unable to kick off the SSIS package. If the Agent job is start...

Sending a summary of SQL Server Agent job failures

SQL Server Agent allows you to create Notifications at the moment a Job succeeds or fails, but I'd like to create a regular notification that sends a summary of the events for those who are one step removed from server maintenance. Is there a way to setup summary notifications that spell out which jobs failed over the last 24 hours? ...

Tracking sql agent Job changes - SQL Server 2008

Hey all - situation: Need track/audit changes in SQL jobs - to be reported in scom for example. SQL job exists job is changed (changed/scheduled/enabled/disabled, etc) Needed: trigger to check for this. Anyone out there already written one? Many thanks, Tom ...

Writing to the history of a SQL Agent Job

Having just created a SQL Agent Job I thought it would be handy to be able to write a little bit of information into the job's history, in case I wanted to check it later. I was using VBScript in this instance, and noted that I could use the Error object to record info in the history, for example: Err.Raise 999, "The code died" If yo...

Deleting SQL Agent job by criteria - script

I want to drop all the SQL Agent Jobs which are not currently running and have description of 'xxxx'. How can this be done in script? As of now i got this done as below and sure there would be better way to do. DECLARE @job_owner_name VARCHAR(100) DECLARE @MaxJobs INT declare @RowCnt INT DECLARE @jobId NVARCHAR(36) select @RowCnt = 1 ...

SQL Job: How to start with ?

Can anyone help me to create an SQL job in SQL server Agent (SQL 2008) ,which will run in a purticular time interval(Ex: Daily) and select records from a table with status=1 (select name,age from student)and pass to another stored procedure which accepts student name and age ...

Get date of last successful job run?

I have a single step job that executes a stored procedure. I would like get the date of the last successful job execution time so that I can just update a delta instead of the whole set of data. Right now I have the job setup to run once every day, so I have a default parameter that if it's null I set it to GETDATE() - 1 so I'm still u...

How to implement SQL Server Job that waits to another job finish?

Hi, I'm looking a way to implement a precedence step on SQL Server Agent that will verify is a specific job is running. If so, the step will entry in a "wait" state until first job finish with success. To clarify, this will be the cenario: Job Name: 'My Job' Job to be checked: 'Validate tables' Steps of 'My job': Step 1: Check if '...

Powershell Transcript is empty when running script from SQL Agent Job in 2005 SQL Server

I have a complex Powershell script that gets run as part of a SQL 2005 Server Agent Job. The script works fine, but it uses the "Start-Transcript $strLogfile -Append" command to log all of it's actions to a transcript file. The problem is that the transcript is always empty. It adds the header and footer to indicate that the transcript i...

How SQL calculates NEXT_RUN_DATE for a job schedule?

I have to make a manual calculation of the next run date for a job, can you help me? ...

SQL Job: CmdExec with Multiple Arguments

Is it possible to specify two arguments to CmdExec in SQL JOb Step? I have MyApp.exe Para1 Para2 but it only recognize para1. ...

SSIS 2005 running in SQL Server Agent on local PC connecting to database on remote server produces the following error message: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

Hello, I'm trying to run an SSIS 2005 package from a SQL Server Agent job on my local PC. This package is attempting to connect to a SQL Server 2005 database on a remote server, but it gets the error message, "Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'". What is the problem and how can I solve it? Thank you in advance. ...

SQL Server Agent 2005 job runs but no output

Essentially I have a job which runs in BIDS and as as a stand lone package and while it runs under the SQL Server Agent it doesn't complete properly (no error messages though). The job steps are: 1) Delete all rows from table; 2) Use For each loop to fill up table from Excel spreasheets; 3) Clean up table. I've tried this MS page (s...

Using current database name in T-SQL has Using statement

Hello everybody. I have application runs T-SQL statements to update more than one database the problem is i'm using the following t-sql USE [msdb] GO DECLARE @jobId BINARY(16) EXEC msdb.dbo.sp_add_job @job_name=N'test2', @enabled=1, @start_step_id=1, @notify_level_eventlog=0, @notify_level_email=2, ...

SQL Agent Command Line Not Saved

I have a SSIS package I am trying to schedule. I create a new job under SQL Server Agent. On the Command line tab of the jobstep, I choose "Edit the command-line manually". The changes are retained as I switch from tab to tab within the job step but whenever I exit and save the job, the changes are lost. Any ideas what's going on? I'm...

SQL Server CLR to embed business logic and schedule execution with SQL Server Agent

Hi, I have the business logic of an workflow-like application in a C# class library, but at end of each month certain process in the library needs to be invoked, i thought that the ideal mechanism to invoke this scheduled execution is using the Sql server agent (sql job preferably, althought i'm open to even go into SSIS hell if its abs...

SQL Server Agent error - Connection "DatabaseName" is not found??

Some modifications were made to an SSIS package and I can't seem to figure out what is wrong. The SQL server agent job which involves execution of one of these packages was running fine until a couple of days ago. The error I am seeing is this... Executed as user: domainname\serviceaccount. ... for 32-bit Copyright (C) Microsoft Cor...

Problem with WMI ConnectServer in a SQL Server Agent job

I'm having trouble using WMI in an ActiveX script within SQL Server Agent (2005). When I run this code inside a job, it hangs at line 6 (ConnectServer). Note: I'm using a file for logging, as SQLActiveScriptHost.Print doesn't work as advertised. Set fso = CreateObject("Scripting.FileSystemObject") Set txt = fso.OpenTextFile("c:\log.tx...