Troubleshooting Guide: Error 10920 – Cannot Alter/Drop Function Used as Resource Governor Classifier
Why This Error Happens
This error occurs because SQL Server 2025 prevents modification or deletion of a user-defined function (UDF) that is currently registered as the active Resource Governor classifier function. The Resource Governor subsystem locks the schema binding of this function to ensure session classification logic remains consistent and available for every incoming connection. Attempting to run ALTER FUNCTION or DROP FUNCTION on this object fails because the engine detects a dependency between the function and the sys.resource_governor_configuration metadata, which cannot be broken without first disassociating the classifier role.
Step-by-Step Resolution Guide
Step 1: Identify the Current Classifier Function
- Open a new query window in SQL Server Management Studio (SSMS) connected to the target instance on Windows Server 2025 or Windows 11.
- Run the following query to confirm which function is currently bound as the classifier:
SELECT classifier_function_id, OBJECT_NAME(classifier_function_id) AS FunctionName
FROM sys.resource_governor_configuration;
- Note the schema and function name returned (e.g.,
dbo.fnClassifier).
Step 2: Disassociate the Classifier Function from Resource Governor
- Execute the following T-SQL to set the classifier function to
NULL, releasing the lock on the UDF:
ALTER RESOURCE GOVERNOR WITH (CLASSIFIER_FUNCTION = NULL);
ALTER RESOURCE GOVERNOR RECONFIGURE;
- This step temporarily disables custom session classification, so all new connections will route to the
defaultworkload group until a new classifier is assigned.
Step 3: Modify or Drop the User-Defined Function
- With the classifier binding removed, run your intended
ALTER FUNCTIONorDROP FUNCTIONstatement against the UDF (e.g.,dbo.fnClassifier). - If you plan to recreate the function with new logic, ensure the
SCHEMABINDINGoption and correct data types remain consistent with Resource Governor requirements (must returnsysname). - Save the updated function script to a local path (e.g.,
C:\SQLScripts\fnClassifier_v2.sql) for version control.
Step 4: Re-Bind the Updated Function as Classifier
- Once the function has been successfully altered or recreated, reassign it as the active classifier:
ALTER RESOURCE GOVERNOR WITH (CLASSIFIER_FUNCTION = dbo.fnClassifier);
ALTER RESOURCE GOVERNOR RECONFIGURE;
- Confirm no syntax errors are returned and the reconfigure command completes successfully.
Alternative or Verification Steps
- Verify the fix by querying
sys.resource_governor_configurationagain to ensureclassifier_function_idmatches the updated function’s object ID viaOBJECT_ID('dbo.fnClassifier'). - If the error persists, check for open sessions still referencing the old execution plan by running
DBCC FREEPROCCACHE(in a test environment only) to clear cached classifier logic before retrying theALTERstatement.