Saturday, June 2, 2012

Change owner of the Maintenance plan

Sometimes when we create a maintenance plan in SQL server, the owner of the maintenance plan will remain same as the user who creates the plan. If the user's account is deleted from the active directory, in that case the job associated with the maintenance plan will fail with below error:

Message
The job failed.  Unable to determine if the owner 
(domain/xxx_user) of job Backup.Subplan_1 has server access (reason: Could not obtain information about Windows NT group/user 'domain/xxx_user', error code 0x5. [SQLSTATE 42000] (Error 15404)). 

To avoid such situation, change the owner of the maintenance plan to 'sa' by executing below update command when you creates the maintenance plan.

--SQL 2008 Server

UPDATE msdb.dbo.sysssispackages
SET [ownersid]=0x01
WHERE [name]='YourMaintPlanName'


--SQL 2005 Server

UPDATE [msdb].[dbo].[sysdtspackages90]
SET [ownersid] = 0x01 --sa user
WHERE [name] = 'YOUR_MAINT_PLAN_OR_PACKAGE'

--change the owner of a SQL Server 2000 Maintenance Plan

UPDATE [msdb].[dbo].[sysdbmaintplans]
SET [owner] = 'sa'
WHERE [plan_name] = 'YOUR_MAINT_PLAN'

--change the owner of a SQL Server 2000 DTS package
--you need to update the owner column as well

UPDATE [msdb].[dbo].[sysdtspackages]
SET [owner] = 'sa',
[owner_sid] = 0x01 --sa user
WHERE [name] = 'YOUR_DTS_PACKAGE'



No comments:

Post a Comment