BUG: Stack Overflow Running CHECKDB Against DB With Many Objects

ID: Q236424


The information in this article applies to:
  • Microsoft SQL Server version 7.0

BUG #: 56055 (SQLBUG_70)

SYMPTOMS

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.


WORKAROUND

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 will perform 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 


STATUS

Microsoft has confirmed this to be a problem in SQL Server version 7.0.


MORE INFORMATION

The DBCC TEXTALLOC, although not recommended for use in Microsoft SQL 7.0, may also cause this error.

Additional query words:

Keywords : SSrvSQL_Admin kbbug7.00 kbDSupport
Version : winnt:7.0
Platform : winnt
Issue type : kbbug


Last Reviewed: December 14, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.