This article was previously published under Q236424
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 56055 (SQLBUG_70)
Running CHECKDB against a database with at least 122,000 objects, causes a stack overflow exception. The number of objects is represented by the count of rows in SYSOBJECTS, NOT the number of tables in the database.
The stack overflow exception may cause Microsoft SQL Server to shutdown. If it does the client will receive a message that the connection has been broken. If the exception does not shutdown Microsoft SQL Server, the client will appear to be still running the DBCC.
Instead of using CHECKDB, use a script to run DBCC CHECKALLOC as well as a loop that executes DBCC CHECKTABLE for all system and user tables. Following is a script that performs this task, that can be scheduled and run using ISQL:
DBCC CHECKALLOC GO declare @tabname sysname declare @exec_string varchar(300) declare tabcr cursor for select name from sysobjects where type = 'S' or type = 'U' order by name open tabcr fetch tabcr into @tabname select @exec_string = "dbcc checktable('" + @tabname + "')" select @exec_string = rtrim(@exec_string) exec(@exec_string) while (@@fetch_status = 0) begin fetch tabcr into @tabname select @exec_string = "dbcc checktable('" + @tabname + "')" exec(@exec_string) end close tabcr deallocate tabcr
Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
254561 INF: How to Obtain Service Pack 2 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
For more information, contact your primary support provider.
The DBCC TEXTALLOC, although not recommended for use in Microsoft SQL 7.0, may also cause this error.