This article focuses on SQL Server 2005 maintenance plans that cannot be removed (SQL Server maintnance plan can not delete), and the following is full text:
A database to change the IP and host name, only the database instance modified, forget to maintain the plan to remove the IP and host name after the restart, maintenance plan can not be deleted. The reason is that these plans are oldsvr@usr-plans on the original connection. How about that!
1. First connect the original database to kill:
Login to MS SQL Server Management Studio (new host), in the view (View[en]/said [JP]), the login server (R), and then delete the old host connection
2. Save the following SQL and execute it in query:
Do not know the other version of MSSQL feasible No, I successfully tested the mssql2005, after the implementation, please refresh the Maintenance Plan tab, found that the original host has been deleted under the name of the maintenance plan.
--delete maintanace plan after chghostname Use [ MSDB]&NBSP SET NOCOUNT ON&NBSP begin tran declare @SubPlanName varchar () SET @ Subplanname= ' subplan_1 ' --get constraint foreign key columns declare @subPlan_id varchar (100), @job_id varchar (m) , @msx_job_id varchar (m), @Schedule_id varchar Select @job_id =job_id,@ MSX_JOB_ID=MSX_JOB_ID,&NBSP @subPlan_id =subplan_id from Sysmaintplan_subplans where Subplan_name= @SubPlanName &NBSP --delete record by order if (@SubPlan_id isn't null and @SubPlan_id <> ') Delete From Sysmaintplan_log where subplan_id= @SubPlan_id if (@SubPlanName <> "and @SubPlanName is not NULL &NBSP Delete from Sysmaintplan_subplans where subplan_name= @SubPlanName if (@Schedule_id was not null and @Schedule_id <> ') Delete from SYsschedules where schedule_id= @Schedule_id if (@job_id is not null and @job_id <> ") Delete From Sysjobs where job_id= @job_id the --after Above, you can still, and so on God damn maintnance TAB&NBSP --now Use code below to refresh the msdb view delete from Msdb.dbo.sysmaintplan_pla NS&NBSP Commit tran if @ @error <>0 Print ' job failure;-(' Else Print ' job down!;-) ' < br> SET NOCOUNT off |