ERROR: 服务器主体 “NT AUTHORITY\SYSTEM” 无法在当前安全上下文下访问数据库

数据库备份  错误(服务器主体 "NT AUTHORITY\SYSTEM" 无法在当前安全上下文下访问数据库 "XXXX"。 BACKUP DATABASE 正在异常终止。)

解决办法:

是在【安全性】,【服务器角色】中sysadmin,中就没有[NT AUTHORITY\SYSTEM],添加 解决问题!

PS C:\Users\Administrator> # 1. 修复系统映像(使用Windows Update源) PS C:\Users\Administrator> Write-Host "正在通过Windows Update修复系统映像..." -ForegroundColor Cyan 正在通过Windows Update修复系统映像... PS C:\Users\Administrator> DISM /Online /Cleanup-Image /RestoreHealth /Source:https://go.microsoft.com/fwlink/?LinkID=799472 /LimitAccess 部署映像服务和管理工具 版本: 10.0.22621.2792 映像版本: 10.0.22631.2861 错误: 87 未在此上下文中识别出 source:https://go.microsoft.com/fwlink/?linkid 选项。 有关详细信息,请参阅帮助。 可以在 C:\Windows\Logs\DISM\dism.log 上找到 DISM 日志文件 PS C:\Users\Administrator> PS C:\Users\Administrator> # 2. 修复.NET Core运行时 PS C:\Users\Administrator> Write-Host "修复.NET Core运行时..." -ForegroundColor Cyan 修复.NET Core运行时... PS C:\Users\Administrator> dotnet restore MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file. PS C:\Users\Administrator> dotnet build-server shutdown Shutting down MSBuild server... Shutting down VB/C# compiler server... VB/C# compiler server shut down successfully. MSBuild server shut down successfully. PS C:\Users\Administrator> dotnet nuget locals all --clear Clearing NuGet HTTP cache: C:\Users\Administrator\AppData\Local\NuGet\v3-cache Clearing NuGet global packages folder: C:\Users\Administrator\.nuget\packages\ Clearing NuGet Temp cache: E:\ai_temp\NuGetScratch Clearing NuGet plugins cache: C:\Users\Administrator\AppData\Local\NuGet\plugins-cache Local resources cleared. PS C:\Users\Administrator> PS C:\Users\Administrator> # 3. 正确配置驱动验证器 PS C:\Users\Administrator> Write-Host "配置驱动验证器..." -ForegroundColor Cyan 配置驱动验证器... PS C:\Users\Administrator> verifier /reset 没有更改任何设置。 PS C:\Users\Administrator> verifier /standard /all 验证程序标志: 0x001209bb 标准标志: [X] 0x00000001 特殊池。 [X] 0x00000002 强制 IRQL 检查。 [X] 0x00000008 池跟踪。 [X] 0x00000010 I/O 验证。 [X] 0x00000020 死锁检测。 [X] 0x00000080 DMA 检查。 [X] 0x00000100 安全检查。 [X] 0x00000800 杂项检查。 [X] 0x00020000 DDI 兼容性检查。 其他标志: [ ] 0x00000004 随机低资源模拟。 [ ] 0x00000200 强制挂起 I/O 请求。 [ ] 0x00000400 IRP 日志记录。 [ ] 0x00002000 堆栈的固定 MDL 检查。 [ ] 0x00004000 驱动程序的固定 MDL 检查。 [ ] 0x00008000 Power 框架延迟模糊处理。 [ ] 0x00010000 端口/微型端口接口检查。 [ ] 0x00040000 系统低资源模拟。 [ ] 0x00080000 DDI 兼容性检查(额外)。 [ ] 0x00200000 NDIS/WLAN 验证。 [ ] 0x00800000 内核同步延迟模糊处理。 [ ] 0x01000000 VM 开关验证。 [ ] 0x02000000 代码完整性检查。 内部标志: [X] 0x00100000 扩展的验证程序标志(内部)。 [X] 指示标志已启用。 引导模式: Persistent 规则: 所有规则都在使用默认设置 扩展: wdm: rules.default 验证的驱动程序: 所有驱动程序 需要重新引导系统才能使更改生效。 PS C:\Users\Administrator> verifier /querysettings 验证程序标志: 0x001209bb 标准标志: [X] 0x00000001 特殊池。 [X] 0x00000002 强制 IRQL 检查。 [X] 0x00000008 池跟踪。 [X] 0x00000010 I/O 验证。 [X] 0x00000020 死锁检测。 [X] 0x00000080 DMA 检查。 [X] 0x00000100 安全检查。 [X] 0x00000800 杂项检查。 [X] 0x00020000 DDI 兼容性检查。 其他标志: [ ] 0x00000004 随机低资源模拟。 [ ] 0x00000200 强制挂起 I/O 请求。 [ ] 0x00000400 IRP 日志记录。 [ ] 0x00002000 堆栈的固定 MDL 检查。 [ ] 0x00004000 驱动程序的固定 MDL 检查。 [ ] 0x00008000 Power 框架延迟模糊处理。 [ ] 0x00010000 端口/微型端口接口检查。 [ ] 0x00040000 系统低资源模拟。 [ ] 0x00080000 DDI 兼容性检查(额外)。 [ ] 0x00200000 NDIS/WLAN 验证。 [ ] 0x00800000 内核同步延迟模糊处理。 [ ] 0x01000000 VM 开关验证。 [ ] 0x02000000 代码完整性检查。 内部标志: [X] 0x00100000 扩展的验证程序标志(内部)。 [X] 指示标志已启用。 引导模式: Persistent 规则: 所有规则都在使用默认设置 扩展: wdm: rules.default 验证的驱动程序: 所有驱动程序 PS C:\Users\Administrator> PS C:\Users\Administrator> # 4. 重建性能计数器 PS C:\Users\Administrator> Write-Host "重建性能计数器..." -ForegroundColor Cyan 重建性能计数器... PS C:\Users\Administrator> cd $env:windir\System32 PS C:\Windows\System32> unlodctr /l 无法打开驱动程序 SYSTEM\CurrentControlSet\Services\/l。状态: 2 PS C:\Windows\System32> lodctr /r 信息: 成功地从系统备份存储中重建性能计数器设置 PS C:\Windows\System32> Start-Sleep -Seconds 5 PS C:\Windows\System32> PS C:\Windows\System32> # 5. 创建RuntimeBroker监控任务(优化版) PS C:\Windows\System32> $scriptContent = @" >> param($ProcessName = "RuntimeBroker") >> $procs = Get-Process $ProcessName -ErrorAction SilentlyContinue >> if($procs) { >> $procs | ForEach { >> $_.ProcessorAffinity = 1 >> $_.PriorityClass = "BelowNormal" >> } >> Start-Sleep -Seconds 5 >> $procs | Where { $_.CPU -gt 30 } | Stop-Process -Force >> } >> "@ >> $scriptContent | Set-Content -Path "$env:TEMP\FixRuntimeBroker.ps1" -Force >> PS C:\Windows\System32> $action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-ExecutionPolicy Bypass -File `"$env:TEMP\FixRuntimeBroker.ps1`"" PS C:\Windows\System32> $trigger = New-ScheduledTaskTrigger -Daily -At 3am PS C:\Windows\System32> Register-ScheduledTask -TaskName "RuntimeBrokerMonitor" -Action $action -Trigger $trigger -User "NT AUTHORITY\SYSTEM" -Description "RuntimeBroker资源监控" -Force TaskPath TaskName State -------- -------- ----- \ RuntimeBrokerMonitor Ready PS C:\Windows\System32> PS C:\Windows\System32> # 6. 最终验证 PS C:\Windows\System32> Write-Host "验证修复结果..." -ForegroundColor Green 验证修复结果... PS C:\Windows\System32> Repair-WindowsImage -Online -RestoreHealth Repair-WindowsImage : 还原操作失败。找不到修复来源,或者无法修复组件存储。 所在位置 行:1 字符: 1 + Repair-WindowsImage -Online -RestoreHealth + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Repair-WindowsImage], COMException + FullyQualifiedErrorId : Microsoft.Dism.Commands.RepairWindowsImageCommand PS C:\Windows\System32> Get-Counter -Counter "\Process(RuntimeBroker*)\% Processor Time" -SampleInterval 1 -MaxSamples 3 Timestamp CounterSamples --------- -------------- 2025/8/18 18:29:44 \\bf-202503252000\process(runtimebroker#4)\% processor time : 0 \\bf-202503252000\process(runtimebroker#3)\% processor time : 0 \\bf-202503252000\process(runtimebroker#2)\% processor time : 0 \\bf-202503252000\process(runtimebroker#1)\% processor time : 0 \\bf-202503252000\process(runtimebroker)\% processor time : 0 2025/8/18 18:29:45 \\bf-202503252000\process(runtimebroker#4)\% processor time : 0 \\bf-202503252000\process(runtimebroker#3)\% processor time : 0 \\bf-202503252000\process(runtimebroker#2)\% processor time : 0 \\bf-202503252000\process(runtimebroker#1)\% processor time : 0 \\bf-202503252000\process(runtimebroker)\% processor time : 0 2025/8/18 18:29:46 \\bf-202503252000\process(runtimebroker#4)\% processor time : 0 \\bf-202503252000\process(runtimebroker#3)\% processor time : 0 \\bf-202503252000\process(runtimebroker#2)\% processor time : 0 \\bf-202503252000\process(runtimebroker#1)\% processor time : 0 \\bf-202503252000\process(runtimebroker)\% processor time : 0 PS C:\Windows\System32> # 运行后检查系统状态 PS C:\Windows\System32> Get-ScheduledTask -TaskName "RuntimeBrokerMonitor" | Format-List * State : Ready Actions : {MSFT_TaskExecAction} Author : Date : Description : RuntimeBroker资源监控 Documentation : Principal : MSFT_TaskPrincipal2 SecurityDescriptor : Settings : MSFT_TaskSettings3 Source : TaskName : RuntimeBrokerMonitor TaskPath : \ Triggers : {MSFT_TaskDailyTrigger} URI : \RuntimeBrokerMonitor Version : PSComputerName : CimClass : Root/Microsoft/Windows/TaskScheduler:MSFT_ScheduledTask CimInstanceProperties : {Actions, Author, Date, Description...} CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties PS C:\Windows\System32> Get-Counter -ListSet *RuntimeBroker* | Select-Object -ExpandProperty Counter Get-Counter : 在 localhost 计算机上找不到任何与以下内容匹配的性能计数器集: *RuntimeBroker*。 所在位置 行:1 字符: 1 + Get-Counter -ListSet *RuntimeBroker* | Select-Object -ExpandProperty ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (:) [Get-Counter], Exception + FullyQualifiedErrorId : NoMatchingCounterSetsFound,Microsoft.PowerShell.Commands.GetCounterCommand PS C:\Windows\System32>
最新发布
08-19
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值