I was checking my emails and saw below error message from SQL Server monitoring tool.
"The job failed. The owner '' of job '' does not have server access.",
That means a DBA had created a SQL Server Agent job with his name as owner. Once he/she will leave the company and account will be removed from AD, the jobs will start failing.
It is good idea to use service account or sa as SQL Server Job owner, so you don't have to worry in case owner leave the company:)
Below Query will return you Job names and their owners.
Now if we would like to update all the job where owner is not sa, we can use below query. You can also modify the query to filter the jobs for which you would like to update owner.
Just to be on safe side, test the script in Development environment before run in production.
"The job failed. The owner '' of job '' does not have server access.",
That means a DBA had created a SQL Server Agent job with his name as owner. Once he/she will leave the company and account will be removed from AD, the jobs will start failing.
It is good idea to use service account or sa as SQL Server Job owner, so you don't have to worry in case owner leave the company:)
Below Query will return you Job names and their owners.
SELECT J.NAME AS JobName ,L.NAME AS OwnerName FROM msdb..sysjobs J LEFT JOIN master.sys.syslogins L ON J.owner_sid = L.sid
Now if we would like to update all the job where owner is not sa, we can use below query. You can also modify the query to filter the jobs for which you would like to update owner.
--Provide the New Owner for The Jobs you like to Change, I am using sa DECLARE @NewOWNERName VARCHAR(100) SET @NewOWNERName = 'sa' DECLARE @OldJobOwner VARCHAR(100) DECLARE @JobName VARCHAR(1000) DECLARE Job_Cursor CURSOR FOR --Change your Query as per requirements, I am selecting all Job where owner<>sa SELECT J.NAME AS JobName ,L.NAME AS OwnerName FROM msdb..sysjobs J LEFT JOIN master.sys.syslogins L ON J.owner_sid = L.sid WHERE L.NAME <> @NewOWNERName OPEN Job_Cursor FETCH NEXT FROM Job_Cursor INTO @JobName ,@OldJobOwner WHILE (@@FETCH_STATUS <> - 1) BEGIN EXEC msdb..sp_update_job @job_name = @JobName ,@owner_login_name = @NewOWNERName PRINT 'Ownerd Change for ' + @JobName + 'Job from ' + @OldJobOwner + ' to '
+ @NewOWNERName FETCH NEXT FROM Job_Cursor INTO @JobName ,@OldJobOwner END CLOSE Job_Cursor DEALLOCATE Job_Cursor
Just to be on safe side, test the script in Development environment before run in production.
There is something liberating and thrilling about knowing that any casino game that you could possibly want to play is available at your fingertips.
ReplyDeletesbobet88 mobile
The company web site is rapidly becoming the first point of contact for most job seekers or prospective clients. Contractors should update their corporate web site so that it provides a professional and interactive presentation of the firm, its goals, key personnel, corporate culture, top achievements, and business philosophy.Cover letter
ReplyDeleteEstablish a Timeline: Your goals establish what you want to do with your career and how you can develop it through incremental steps. Your priorities determine the immediacy of your goals. For example, ashamed of being unemployed a goal and top priority may be finding a job immediately.
ReplyDelete
ReplyDeleteThis is also a very good post which I really enjoyed reading. It is not every day that I have the possibility to see something like this..
Jobs
I adore your websites way of raising the awareness on your readers.fake packwoods
ReplyDelete
ReplyDeleteI am looking for and I love to post a comment that "The content of your post is awesome" Great work!
먹튀사이트검증
It is perfect time to make some plans for the future and it is time to be happy. I've read this post and if I could I desire to suggest you some interesting things or suggestions. Perhaps you could write next articles referring to this article. I want to read more things about it! For more visit here construction employment recruiters in USA
ReplyDeleteI’ve been absent for a while, but now I remember why I used to love this website. Thank you, I will try and check back more often. How frequently you update your site? Pharmacist Jobs in Government
ReplyDeleteAwesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work! romani in uk
ReplyDeleteIf we had to relate this to a job description, then it would probably entail the production of goods in a manner that is more efficient than it would have been produced under traditional means. If this is the case then I propose this basic definition: California environmental jobs
ReplyDeleteThe fifth factor that can produce peak performance in sports is actually finding the right players to fill up the most key positions of the team first. In any sport teams, there will be key positions that must be filled first. portable dartboard stand
ReplyDeleteThank you very much for writing such an interesting article on this topic. This has really made me think and I hope to read more. ランディングページ制作
ReplyDeleteIt is great to have the opportunity to read a good quality article with useful information on topics that plenty are interested one.I concur with your conclusions and will eagerly look forward to your future updates. need job fast
ReplyDeleteNo doubt Social Media Networking - Facebook, Twitter, LinkedIn and sources like DIGG are powerful agents, however one must realize that they are informational/promotional platforms and vehicles - in themselves, they are not a Marketing solution. Salesforce interview questions and answers
ReplyDeleteNice information, valuable and excellent design, as share good stuff with good ideas and concepts, lots of great information and inspiration, both of which I need, thanks to offer such a helpful information here. job bank
ReplyDeleteEverything has its value. Thanks for sharing this informative information with us. GOOD works! Fair Work Australia
ReplyDeleteCauti locuri de munca in Romania sau Strainatate? Intra acum pe MyNextJob. La noi gasesti oferte de angajare si joburi care ti se potrivesc! anunturi munca
ReplyDeleteThis is my first time visit to your blog and I am very interested in the articles that you serve. Provide enough knowledge for me. Thank you for sharing useful and don't forget, keep sharing useful info: aesthetic injection courses
ReplyDeleteYou always have the best ideas Jobs
ReplyDeleteYou make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. jobs
ReplyDeleteThis is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. visit yourvirtualofficelondon.co.uk
ReplyDeleteYour site is truly cool and this is an extraordinary moving article. Enewresult
ReplyDelete