SQLServer 错误: 15404,无法获取有关 Windows NT 组/用户
修改电脑名称.导致 SQLServer 错误: 15404,无法获取有关 Windows NT 组/用户 是否有伺服器存取權 (原因: 無法獲得關於 Windows NT 群組/使用者 '' 的資訊,錯誤碼 0x534。
可以通过如下命令批量调整作业的所有者,之后重启服务即可.
SELECT [job_id] ,[originating_server_id] ,[name] ,[enabled] ,[description] ,[start_step_id] ,[category_id] ,[owner_sid], ISNULL(suser_sname(owner_sid), '') FROM [msdb].[dbo].[sysjobs] --where ISNULL(suser_sname(owner_sid), '')='NT AUTHORITY\SYSTEM' where name in ('BPM.EMPABS','MaintenancePlan_to_mes.me_to_erp') update [msdb].[dbo].[sysjobs] set owner_sid=( select owner_sid from [msdb].[dbo].[sysjobs] where name='BPM.EMPABS') where ISNULL(suser_sname(owner_sid), '')='KMFW_ERP\Administrator'
订正一下,还需要修改 sysdtspackages90 sysschedules 两个表.重启服务才可以.
drop table #temp_planlist; WITH X AS ( SELECT id,name,PlanXML=CAST(CAST(packagedata AS VARBINARY(MAX)) AS XML) FROM msdb.dbo.sysdtspackages90 ) select rank() over(order by id) idx,* --into #temp_planlist from X where PlanXML.value('declare namespace DTS="www.microsoft.com/SqlServer/Dts";(/DTS:Executable/DTS:ConnectionManager[1]/DTS:ObjectData/DTS:ConnectionManager/DTS:Property[@DTS:Name=("ConnectionString")]/text())[1]','varchar(max)') like 'server=''KMFW_ERP''%'; declare @pkgdata xml,@id varchar(100),@idx int; set @idx = (select min(idx) from #temp_planlist); while @idx <= (select max(idx) from #temp_planlist) begin SET @id =(select id from #temp_planlist where idx = @idx) set @pkgdata = (select CAST(CAST(packagedata AS VARBINARY(MAX)) AS XML) FROM msdb.dbo.sysdtspackages90 where id = @id); SET @pkgdata.modify('declare namespace DTS="www.microsoft.com/SqlServer/Dts";replace value of (/DTS:Executable/DTS:ConnectionManager[1]/DTS:ObjectData/DTS:ConnectionManager/DTS:Property[@DTS:Name=("ConnectionString")]/text())[1] with "server=''.'';Trusted_Connection=true;Application Name=''Microsoft SQL Server Management Studio'';Pooling=false;Packet Size=4096;multipleactiveresultsets=false;"'); update msdb.dbo.sysdtspackages90 set packagedata = CAST(@pkgdata AS varbinary(max)) where id = @id; SET @idx = @idx+1; end