DECLARE @instance_id int;
SELECT @instance_id = mi.instance_id
FROM msdb.dbo.sysutility_ucp_managed_instances AS mi
WHERE mi.instance_name = 'defunctservrname\instancename';
EXEC msdb.dbo.sp_sysutility_ucp_remove_mi @instance_id;
--must run code on new query page for each server
--below will show all instance in UCP, what important is instance id
SELECT * FROM msdb.dbo.sysutility_ucp_managed_instances
--now delete CUP by instance id, if you added 2 nodes into 1 CUP then do this for instance 1 and 2 or other if any!
EXEC msdb.dbo.sp_sysutility_ucp_remove_mi 1;
-- delete UCP data
EXEC msdb.dbo.sp_sysutility_mi_remove;
--below will delete all jobs and other objects created by UCP for the specified server
[msdb].[dbo].[sp_syscollector_cleanup_collector]
EXEC msdb.dbo.sp_sysutility_ucp_remove;
我最近不得不从 UCP 中删除一个失效的实例。就是这样:
我苦苦思索了 2 个小时,想知道如何从我的服务器中删除 UCP,最后我找到了以下解决方案。
小心,老实说,我不知道在生产环境中运行这段代码是否会有副作用,但对我来说,这是我第一次创建 CUP,我没有什么可失去的,所以它工作得很好!
有时我也会以不同的顺序重新运行代码