sql-server-agent

SQL Server Agent Job Set Up

依然范特西╮ 提交于 2019-12-30 14:52:03
问题 I'm a newbie to SQL and .Net and this question might be stupid too to ask but I still need help. I've a Database located on Server1. Now I got another Server, lets call it Server2 to work on my Development. Server1 on which my database is located seems to be a SQL Server Express installation so I don't see a SQL Server Agent in there. Server2 has a SQL Server Agent. So can I use Server2's SQL Server Agent and schedule queries to run automatically on Server1? Is this possible? If it is then

How to Prevent Sql Server Jobs to Run simultaneously

一笑奈何 提交于 2019-12-28 13:52:27
问题 I have some scheduled jobs in my SQL Agent: Job1, executing every 2 minutes Job2, executing every 10 minutes Job3, executing every 15 minutes As you can see, multiple jobs can run simultaneously. When these jobs do run simultaneously, it is causing the CPU usage to go to 100%. Is there a solution? Is there a way to control the number of jobs running concurrently? Note: I need these jobs to run approximately in their appropriate period. 回答1: Use a session lock via sp_getapplock You're asking

How to start SQL Server agent jobs automatically

巧了我就是萌 提交于 2019-12-22 13:33:09
问题 I am writing PowerShell scripts to control SQL Server agent start/stop to ensure all the contained jobs runs according to defined schedule. I want to make sure that the only thing I need to do is to start the SQL Server Agent Windows Service, and then all the contained SQL Server Jobs will run automatically according to defined schedule? No need to control each job's start/stop specifically? I am using SQL Server 2008 on Windows Server 2003. thanks in advance, George 回答1: When you start SQL

Can you run an SSIS task from .net?

瘦欲@ 提交于 2019-12-20 12:34:08
问题 I have scheduled sql agent task which runs an SSIS package. I want to be able to run the SSIS package from .net. Is there a way to either run the SSIS package directly or at least run the SQL agent task which would in turn run the SSIS package. If it helps it is for a .net 3.5 web app written in C# Thanks! 回答1: The options that are available to run a SSIS package are - Run package programmatically using SSIS Object Model. This is discussed in details in Books Online here. An Example: using

Cannot bulk load because the file could not be opened. Operating System Error Code 3

故事扮演 提交于 2019-12-20 10:18:12
问题 I'm trying to set up a Stored Procedure as a SQL Server Agent Job and it's giving me the following error, Cannot bulk load because the file "P:\file.csv" could not be opened. Operating system error code 3(failed to retrieve text for this error. Reason: 15105). [SQLSTATE 42000] (Error 4861) Funny thing is the Stored Procedure works just fine when I execute it manually. The drive P: is a shared drive on Windows SQL Server from LINUX via Samba Share and it was set up by executing the following

Attachment file \\SERVER\file.csv is invalid. [SQLSTATE 42000] (Error 22051). The step failed

柔情痞子 提交于 2019-12-20 04:59:19
问题 I've got 4 SQL servers: SQL Server 2005, SQL Server 2008, SQL Server 2008 R2 and SQL Server 2012. In SQL Server 2008 R2; I have created a SQL job that sends me email every Monday with reports from SQL Server 2005, SQL Server 2008 and SQL Server 2008 R2 on databases that are older than 3 months and it works just fine. But, now that I want to add SQL Server 2012, the job fails with the following error: Executed as user: NT AUTHORITY\SYSTEM. Configuration option 'show advanced options' changed

Create SQL Server Agent jobs programatically

不打扰是莪最后的温柔 提交于 2019-12-20 04:31:28
问题 I want to create SQL Server Agent jobs programmatically. I am using the following code, while running it doesn't throw any error but when I check SQL Server Agent I don't see any jobs. So question 1: is this the right way to create a job in msdb from etgv125p (my database) database? When I use connectionString with Initial Catalog=msdb , I am getting an error The EXECUTE permission was denied on the object 'CreateSQLAgentjobs', database 'msdb', schema 'dbo' Question 2: what type of

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

半世苍凉 提交于 2019-12-19 20:46:24
问题 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 run of the code: Job 'test2' started successfully. Second run of the code (within 10 seconds): Msg 22022, Level 16, State 1, Line 0 SQLServerAgent Error: Request to run job test2 (from User sa) refused because the job is already running from a request by

How to monitor SQL Server Agent Job info in C#

偶尔善良 提交于 2019-12-17 09:50:02
问题 I need to create an application for monitoring SQL Server 2000 Agent Job status and info when Job occur same as show on Windows application event log. Now I connect to the database already via a connection string, but I don't know how to get the status and info from Job. I need to show status and info on Textbox. What do you suggestion how to do. Developer tools : MS SQL Sever 2000 SP4 MS Visual Studio 2008 (C#) I am a rookie programmer. 回答1: i can do this already... i select form table

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

孤街醉人 提交于 2019-12-12 10:45:31
问题 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 wouldn’t be a problem because the time difference between the UK and US is 6 hours so we schedule our job for 22:30. But because the UK and US adjust their clocks at different times in March and November for daylight savings, there is a 2 week period when