Article ID: 267953 - View products that this article applies to.
This article was previously published under Q267953
BUG #: 236625 (SHILOH_BUGS)
BUG #: 58063 (SQLBUG_70)
If one connection prepares a query but never runs the query, while a second connection is running the same query ad hoc, SQL Server might begin to recompile the query infinitely. More and more memory is used as the recompile continues, CPU utilization is high, and the server might become very sluggish. You may eventually encounter the following 17803 error messages in the SQL Server errorlog as memory is depleted:
Generally, you must re-start SQL Server to recover from this situation.
2000-06-14 17:09:21.31 ods Error: 17803, Severity: 17, State: 14
2000-06-14 17:09:21.31 ods Insufficient memory available..
SQL Server 2000To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/290211/EN-US/ )INF: How to Obtain the Latest SQL Server 2000 Service Pack
HotfixNOTE: The following hotfix was created prior to Microsoft SQL Server 2000 Service Pack 1.
The English version of this fix should have the following file attributes or later:
NOTE: Due to file dependencies, the most recent hotfix or feature that contains the above files may also contain additional files.
Version File name Platform ----------------------------------- 8.00.217 s80217i.exe x86
SQL Server 7.0To resolve this problem, obtain the latest service pack for SQL Server 7.0. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/301511/EN-US/ )INF: How to Obtain the Latest SQL Server 7.0 Service Pack
To work around this problem:
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
SQL Server 2000This problem was first corrected in SQL Server 2000 Service Pack 1.
SQL Server 7.0This problem was first corrected in SQL Server 7.0 Service Pack 3.
A prepare of a query can be performed in OLE DB or ODBC by calling ICommandPrepare::Prepare or SQLPrepare, respectively. This is typically done when the same query is to be run many different times. You run the prepared query by calling ICommand::Execute or SQLExecute.
It might be possible to run DBCC FREEPROCCACHE to flush the plans from the cache. If you can do this, then that is sufficient to stop the recompile loop and the server stabilizes.
You can detect this problem by watching the following Performance Monitor counters:
SQL Server:Cache Manager - Cache Use Counts/sec for Adhoc Sql Plans
SQL Server: SQL Statistics - SQL Recompilations/sec
SQL Server: SQL Statistics - Batch Requests/sec
SQL Server: SQL Statistics - Compilations/sec
The first two counters jump to a very high value (generally 50000 or higher on a multi-processor computer), while the last two counters drop to nearly zero, even if there are queries being sent to the server from other connections.
You do not have to have a multi-processor computer to encounter this problem, but the problem does happen more quickly in a multi-processor computer environment.
Contact us for more help
Connect with Answer Desk for expert help.