How to fix Error 8315 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 8315 – Performance Counter Not Found in Registry

Why This Error Happens

This error typically occurs when the performance counter registry entries for SQL Server 2025 have become corrupted, were not registered correctly during installation, or were overwritten by another application’s installer. It can also arise when the lodctr/unlodctr counter DLLs lose synchronization with the registry due to incomplete patching, failed Cumulative Updates, or insufficient administrative permissions during setup. In some cases, third-party monitoring tools or antivirus software interfere with the registry keys under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services, causing SQL Server to disable its performance counter subsystem entirely.

Step-by-Step Resolution Guide

Step 1: Verify Administrative Privileges and Service Account Permissions

  • Ensure you are running SQL Server services and any repair tools as a local Administrator.
  • Open an elevated Command Prompt (Run as Administrator) before executing any registry or counter commands.
  • Confirm the SQL Server service account has “Read” and “Write” access to HKLM\SYSTEM\CurrentControlSet\Services\PerfProc\Performance.

Step 2: Rebuild the Performance Counter Library

  • Navigate to the Binn folder, typically located at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Binn\.
  • Run the following command to unload the corrupted counters:
    unlodctr MSSQLSERVER
  • Immediately reload the counters using the installation XML definition file:
    lodctr /M:sqlctr.ini or run the batch file sqlctr160.bat if present (adjust version number for SQL Server 2025 build).
  • Restart the “Windows Management Instrumentation” service (winmgmt) to clear cached counter data.

Step 3: Re-register Counters via Instance-Aware Utility

  • For named or multiple instances, use the instance-specific registration tool: lodctr /M:perf-MSSQLSERVER-sqlctr.xml.
  • Locate this XML file in the Binn directory if the standard .ini method fails due to Unicode/XML formatting changes in SQL 2025.
  • Clear the “Last Counter” and “Last Help” values under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib if duplicate IDs are suspected, then re-run the load command.

Step 4: Restart Services and Validate Registry Integrity

  • Restart the SQL Server (MSSQLSERVER) service via services.msc or net stop MSSQLSERVER && net start MSSQLSERVER.
  • Run sfc /scannow to rule out underlying Windows Server 2025 system file corruption affecting the Perflib subsystem.
  • Check the SQL Server Error Log for the absence of the 8315 error upon restart.

Alternative or Verification Steps

  • Open Performance Monitor (perfmon.exe), click the green “+” icon, and verify that “SQLServer:General Statistics” and other SQL-specific counter groups appear in the list without errors.
  • If the rebuild fails, run lodctr /R to perform a full rebuild of all system performance counter values from the system registry’s backup store, then repeat Step 2 specifically for the SQL Server counters.