Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Remove failed jobs from agent

Author  Topic 

V.V.
Starting Member

32 Posts

Posted - 2015-01-26 : 13:44:48
Hello guys!

Recently I've tried to implement couple of jobs in SQL Server Agent in order to save more time doing some everyday tasks. They weren't perfect from start and I have some failed lines in SQL Agent. Some guys will want to see some reports if everything is ok and I'm not sure if they will understand that I was testing and it happened to fail.

Is there a way to remove those failed jobs from log viewer?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-01-26 : 14:06:34
One way is to change the settings in the SQL Server Agent properties on the History page. Another way is to run sp_purge_jobhistory, but that'll clear all history for the job.

I'm sure it can be done by deleting the rows from the respective msdb tables, however I would not recommend it. Instead, I would just send an email to the appropriate parties that will be viewing the report.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

V.V.
Starting Member

32 Posts

Posted - 2015-01-27 : 04:31:42
Hello #tkizer and thank you for replying. :)

Yes, I will manage somehow and explain them if they're asking. I only wanted to know if is possible without risks.

I want to ask you one more thing: if I set the Agent to "Automatically delete the job" when the job fails...it means that will delete that line and keeps the history intact?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-01-27 : 12:02:19
I don't think that's what you want. It deletes the entire job, not just the failed state. But if you want to get rid of a job if it fails, then sure you can use the auto-delete feature. We only use the auto-delete feature for a temporary job and when that job succeeds.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

viggneshwar
Yak Posting Veteran

86 Posts

Posted - 2015-01-28 : 09:21:27
Even if you delete job it will maintain history. so instead of thinking to remove from history. Inform to the relevant persons regarding your test and then proceed. If you are trying in test environment you no need to worry about things happened.

Regards
Viggneshwar A
Go to Top of Page
   

- Advertisement -