Published on

May 19, 2012

Understanding SQL Server Resource Governor

Welcome to another blog post on SQL Server! In today’s article, we will discuss the concept of Resource Governor and address a common issue that users face when trying to remove the resource governor from their SQL Server.

Before we dive into the problem, let’s quickly recap what Resource Governor is. Resource Governor is a feature in SQL Server that allows you to manage and allocate server resources to different workloads or applications. It helps in controlling and prioritizing the usage of CPU, memory, and disk I/O, ensuring that critical workloads get the necessary resources.

Now, let’s address the issue that one of our readers encountered. They had successfully configured the resource governor on their development server and performed some tests. However, when they tried to remove the resource governor, they faced an error while trying to drop the classification function.

The error message they received was: “Cannot drop user-defined function myudfname. It is being used as a resource governor classifier.” This error occurs because the classifier function is associated with the resource governor and cannot be dropped directly.

So, how can we resolve this issue? The solution is quite simple. We need to create a new classifier function for the resource governor or assign NULL to the existing classifier function. Once this is done, we can disable the resource governor and then drop the function without any errors.

Here is an example of the T-SQL script that can be used to achieve this:

ALTER RESOURCE GOVERNOR WITH (CLASSIFIER_FUNCTION = NULL)
GO
ALTER RESOURCE GOVERNOR DISABLE
GO
DROP FUNCTION dbo.UDFClassifier

By setting the CLASSIFIER_FUNCTION to NULL, we are effectively removing the association between the classifier function and the resource governor. This allows us to drop the function without any issues.

It’s important to note that this solution should only be used if you are certain that you will not be using the function in the future. If you plan to enable the resource governor again and use the same function, it is recommended to create a new classifier function instead of dropping the existing one.

Lastly, I want to emphasize the importance of conducting experiments and tests on a development server rather than a production server. The production server should never be used as a playground for experiments, as it can lead to potential issues and downtime.

I hope this article has provided you with a clear understanding of the Resource Governor in SQL Server and how to resolve the issue of dropping the classifier function. If you have any further questions or if there is a better way to achieve the same result, please feel free to reach out to me.

Stay tuned for more SQL Server tips and tricks in future blog posts!

Click to rate this post!
[Total: 0 Average: 0]

Let's work together

Send us a message or book free introductory meeting with us using button below.