I'm using the msdb.dbo.sp_help_jobhistory to get the history of each step that has executed in each package which is I believe the same query executed if doing a view history on the right click of the job.
My problem is there doesn't seem to be any way of tying a run of a job together. E.g.
What I need to do is tie it up like it does in the UI to each run of the job:
Use sysjobs, sysjobhistory, sysjobactivity, and sysjobschedules (all found in the msdb database). You can tie everything together using job_id.
Related
Is there a way to change SQL Server Agent history values. I would to modify limit size of job history log from the defaults. Is there a way to change without use GUI for AWS RDS Instance.
Generally speaking, anything you can do in the GUI can be scripted by selecting the "Script" button at the top of the dialog/window rather than selecting the OK button at the bottom right. For this case, you will get something like:
USE [msdb]
GO
EXEC msdb.dbo.sp_set_sqlagent_properties #jobhistory_max_rows=1001,
#jobhistory_max_rows_per_job=101
GO
I am trying to change a job start time in SQL Server by Removing the existing schedule and creating a new one.
Unfortunately, Microsoft doesn't want to let me delete the existing schedule from the job. I get the error
Only owner...can delete the job schedule.
I am the owner. I created the job using the same login that I am using to change it. My username is in the properties as the Owner (FU MS).
I am only trying to remove the schedule from the Job but the error seems to indicate that I am trying to delete the schedule. I think my original mistake was to use an existing schedule rather than create a new duplicate one.
How do I work-around (yet another stupid) permission problem? Or am I doing this wrong?
If it didn't have so many steps, I would just (try to) delete it.
I created an sql server agent job that consists of steps that are calls to ssis packages.
Let's say that the job is being executed and one of the steps (that is a ssis package) has a file system task/sql task etc that fails. Is there any way that can I retry/rerun this particular package step (file system task/sql task etc) and then go on with my execution of the rest of the job steps after I fix my error? I know that you can retry certain sql server agent jobs and steps but I can't find any way to retry this step and resume my execution in case something inside the package fails.
And I also want to know if there is any way to disable certain package steps from the sql server agent "level" - without having to open Data tools.
Thank you.
Go into the job properties, and into the step that contains the SSIS package. Go to the Advanced tab, and you can modify the number of Retry Attempts for that step.
You could always put some error handling into the package in question. If an exception occurs, it will be handled accordingly allowing the other packages to continue. I always handle exceptions within the packages and log exceptions to a table.
In relation to your other question:
"And I also want to know if there is any way to disable certain package steps from the sql server agent "level" - without having to open Data tools. "
You could always go down the PowerShell route, create a script that takes a parameter. The parameter specifying whether or not you want a specific package to run.
If you want to skip certain steps within the package then you would have to create some sort of precedent constraint that acts on a variable you have set.
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.
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 the job from SQL Agent
3) Perform your edits in the create script
4) Execute the create job
This will allow you to keep your manually modified command line options.
There is a bug with the Set Values properties in SQL Server Agent for SSIS packages. You need to save the job step while still on the tab I think(?). I'll see if I can remember and reproduce the steps, but you're not going crazy. ;)
You may need to click "OK" for the job step, and "OK" for the job before moving on to any other changes in the job.
try a copy save as on the package and save change the protection level to encrypt sensitive data with password
I had the same issue when trying to append /DumpOnError to the command line tab of the only step in a job. What I realized was that the change was really performed. And I found it out by generating the "create job" script. What was happening then? Well, it seems as if in the edit box of the command line tab you always got the "default" configuration, however the real one is. I checked it on three installations. 2008 standard, 2012 enterprise and 2017 enterprise.
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 double-clicking a job or entering job's properties I get empty "New Job" window.
Is there some way to correct this behavior?
You can genereate SQL Script for SQL Job and then edit it. right click the job and then
click generate SQL Script. Here you can also change the job properties with the sql sciript
I ran into this problem a while back. I'm not entirely sure what caused it, but the fix was installing sp2 of sql server onto my local machine (or whichever machine you're using ssms on). the only documentation i found at the time suggested that that was the only solution.
I suggest you create a new job explicitly, then try editing your new job the same way and see what happens.
In particular, it's possible that your old job really is empty.
not sure what your issue with SSMS is. Maybe you dont have permission?
Unless your sa you need to be a member of the SQLAgentOperatorRole in MSDB?
If you can still run queries then look at the sysjobs and sysjobsteps tables in the MSDB database, this has all the properties
You can use the sp_update_job to modify the job