MSSQLSERVER_2814

New: 17 November 2008

Details

Product Name

SQL Server

Product Version

9.0

Product Build Number

 

Event ID

2814

Event Source

MSSQLSERVER

Component

SQLEngine

Symbolic Name

PR_POSSIBLE_INFINITE_RECOMPILE

Message Text

A possible infinite recompile was detected for SQLHANDLE %hs, PlanHandle %hs, starting offset %d, ending offset %d. The last recompile reason was %d.

Explanation

One or more statements caused the query batch to recompile at least 50 times. The specified statement should be corrected to avoid further recompilations.

The following table lists the recompilation reasons.

Reason Code Description

1

Schema changed

2

Statistics changed

3

Deferred compile

4

Set option changed

5

Temp table changed

6

Remote rowset changed

7

For Browse permissions changed

8

Query notification environment changed

9

Partition view changed

10

Cursor options changed

11

Option (recompile) requested

User Action

  1. View the statement causing the recompilation by running the following query. Replace the placeholders shown in angle brackets < > with the values specified in the error message. Note that the database_name and object_name columns will be NULL for ad hoc and prepared SQL statements.

    SELECT DB_NAME(st.dbid) AS database_name
        , OBJECT_NAME(st.objectid) AS object_name
        , st.text
    FROM sys.dm_exec_query_stats AS qs
    CROSS APPLY sys.dm_exec_sql_text (<sql_handle>) AS st
    WHERE qs.statement_start_offset = <starting offset>
    AND qs.statement_end_offset = <ending offset>
    AND qs.plan_handle = <plan_handle>;
    
  2. Based on the reason code description, modify the statement, batch, or procedure to avoid recompilations. For example, a stored procedure may contain one or more SET statements. These statements should be removed from the procedure. For additional examples of recompilation causes and resolutions, see Batch Compilation, Recompilation, and Plan Caching Issues in SQL Server 2005.

  3. If the problem persists, contact Microsoft Customer Support Services.

See Also

Other Resources

SQL:StmtRecompile Event Class

Help and Information

Getting SQL Server 2005 Assistance