Thursday, July 12, 2012

Change Maintenance Plan Owner to ‘sa’


I always had this annoying issue where in I had to update the job owner to ‘sa’ once someone had modified a maintenance plan. This happens when a user logs in with his id (which usually everyone does) and modifies a Maintenance Plan and then saves it. This automatically changes the owner of the job corresponding to it.
Below mentioned query is handy when you need to update lot of Maintenance Plans like this.
–SQL 2005
UPDATE msdb.dbo.sysdtspackages90
SET ownersid =SUSER_SID(‘sa’)
WHERE name ‘MAINT’
 –SQL 2008
UPDATE msdb.dbo.sysssispackages
SET ownersid =SUSER_SID(‘sa’)
WHERE name ‘MAINT’
–**************************
MvM

No comments:

Post a Comment