sql-server-agent

SQL Server: How to run a query every hour, and store results in a table? Replace them on update

佐手、 提交于 2019-12-11 15:27:40
问题 I have this taxing query that takes 5 minutes, and I'd like to have its results stored in a table, which will be queried by a backend. Also, the table should be updated every hour and completely replace the table's content with the new data. I found this Server Agent solution, and from my understanding I should to this: Create the results table. Create a stored procedure that drops the results table data, runs the 5 min query, and inserts the new data. Create the Server Agent job that runs

SQL Server - TSQL to Detect missed Agent jobs due to overrun

可紊 提交于 2019-12-11 10:15:47
问题 I am trying to work out the TSQL to detect if a JOB has overran and missed its next schedule. Scenario: Job is scheduled to run every hour (there may be more than one schedule enabled), but due to some reason such as network delays, the job stops taking 10 minutes and is now running for 90 minutes and therefore missing it's hourly start. There is a table called msdb.dbo.sysjobactivity, which has a column called next_scheduled_run_date but this date only gets update after the currently running

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

你。 提交于 2019-12-11 07:57:41
问题 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 absolutely required), but the question is how do i invoke the process of the application library from the sql job? the application library is also used from asp.net

How To change backup path in sql server agent

久未见 提交于 2019-12-11 04:47:29
问题 i want to change my backup location of sql server 2008 r2 ,i am using sql server agent to do backup job ,now the drive is full i want to make the backup into other drive.please provide me the steps how to resolve this issue 回答1: Go to Management>Maintenance Plan> Then select the plan and change the destination auto folder path from the property window 来源: https://stackoverflow.com/questions/23089219/how-to-change-backup-path-in-sql-server-agent

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

梦想的初衷 提交于 2019-12-11 01:48:55
问题 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 is starting and stopping, but it doesn't actually log anything. Example: ********************** Windows PowerShell Transcript Start Start time: 20100304173001

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

ⅰ亾dé卋堺 提交于 2019-12-11 01:29:32
问题 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 SQL agent job, it fails. I've read around extensively on this topic, and it seems a lot of the advise concerns how you are logged in, configuring of proxy

SQL Agent Command Line Not Saved

风流意气都作罢 提交于 2019-12-11 01:26:51
问题 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 on SQL Server 2008. 回答1: This is a confirmed bug, but here's a workaround that my team uses: 1) Script the create job statement (without your edits) 2) Delete

SQL Agent: Set a Max Execution Time

拜拜、爱过 提交于 2019-12-11 00:33:32
问题 Afternoon. I have several SQL Agent jobs running on an MS 2K8 BI server, some of them on a daily basis, others hourly, and one every two minutes (a heartbeat monitor for another process). There is also an app which imports data every few minutes, around the clock. Occasionally some combination of updates and reports collide and one or another hangs for a half hour or more, instead of the usual 60 seconds. While I need to get to the root of these race conditions, in the meantime I'd like to

How to catch the exit code of a CMDEXEC SQL Server Job?

泄露秘密 提交于 2019-12-10 19:08:38
问题 The following SQL Server job always exits with return code 0 indicating success, when in fact it does not do its job, i.e. it does not delete "test.txt". How can I catch the actual exit code (something like %ERRORLEVEL%, or a 'permission denied'-like message, or any meaningful response indicating success or failure of @command at msdb.dbo.sp_add_jobstep)? Remarks: {DBname} is the name of the database I am the owner of {proxyName} is the name of the SQL Server Agent Proxy (that is active to

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

半腔热情 提交于 2019-12-10 12:37:01
问题 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 returned DTSER_FAILURE (1). Started: 09:25:03 Finished: 09:25:04 Elapsed: 0.61 seconds. The package execution failed. The step failed. The SSIS package itself