Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

Microsoft distributes Microsoft SQL Server 2008 R2 Service Pack 1 (SP1) fixes as one downloadable file. Because the fixes are cumulative, each new release contains all the hotfixes and all the security updates that were included with the previous SQL Server 2008 R2 Service Pack 1 (SP1) update release.

Symptoms

When a SQL Server performance condition alert is raised in Microsoft SQL Server 2008 R2, you might receive the following error message:

Msg 512, Level 16, State 1, Procedure sp_sqlagent_get_perf_counters, Line 40
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

Additionally, the error message is logged in the SQL Server Agent error log in this situation.

Note This issue also occurs in Microsoft SQL Server 2008.

Cause

This issue occurs because the subquery of the msdb.dbo.sp_sqlagent_get_perf_counters system stored procedure calculates the value of a counter incorrectly.

The subquery lacks an inner join relationship for the [object_name] column in the condition of the subquery. Therefore, multiple rows are incorrectly returned, and the issue that is mentioned in the "Symptoms" section occurs.

Note The msdb.dbo.sp_sqlagent_get_perf_counters system stored procedure runs when a SQL Server performance condition alert is raised.

Resolution

Cumulative update information

Cumulative update package 3 for SQL Server 2008 R2 SP1

The fix for this issue was first released in cumulative update package 3. For more information about how to obtain this cumulative update package for SQL Server 2008 R2 SP1, click the following article number to view the article in the Microsoft Knowledge Base:

2591748 Cumulative update package 3 for SQL Server 2008 R2 SP1Note Because the builds are cumulative, each new update release contains all the hotfixes and all the security updates that were included with the previous SQL Server 2008 R2 SP1 update release. We recommend that you consider applying the most recent update release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2567616 The SQL Server 2008 R2 builds that were released after SQL Server 2008 R2 SP1 was released

Workaround

To work around this issue, update the subquery of the msdb.dbo.sp_sqlagent_get_perf_counters system stored procedure. To do this, add the following condition to the WHERE clause of the four subqueries that are used in the [value] column calculation:

(spi1.[object_name] = spi2.[object_name])

After you add the condition, the subqueries resemble the following:

SELECT CASE spi2.cntr_value WHEN 0 THEN 1 ELSE spi2.cntr_value END
FROM sys.dm_os_performance_counters spi2
WHERE (spi1.[object_name] = spi2.[object_name])
AND (spi1.counter_name + ' ' = SUBSTRING(spi2.counter_name, 1, PATINDEX('% Base%', spi2.counter_name)))
AND (spi1.instance_name = spi2.instance_name)
AND (spi2.cntr_type = @perfTypeLargeRawBase


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×