FIX: SQL Server May Become Unresponsive When a Large Number of Databases and Roles are Used

Article translations Article translations
Article ID: 318733 - View products that this article applies to.
This article was previously published under Q318733
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 102432 (SQLBUG_70)
Expand all | Collapse all


SQL Server may become unresponsive with high CPU utilization under the following conditions:
  • There are a large number (around 100 or more) of databases on the server.
  • There are a large number (around 100 or more) of roles or groups in each database.
  • A particular user has access to all the databases.
  • The user belongs to one of the last roles or groups defined in each database.
  • The user keeps switching between the databases, which causes a large number of database context switches.
If the server becomes unresponsive with high CPU utilization, the only way to overcome the problem is to kill the Sqlservr.exe process.

Please see the "More Information" section of this article for more details.


To resolve this problem, obtain the latest service pack for Microsoft SQL Server 7.0. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
301511 INF: How to Obtain the Latest SQL Server 7.0 Service Pack
NOTE: The following hotfix was created prior to Microsoft SQL Server 7.0 Service Pack 4.

The English version of this fix should have the following file attributes or later:
   Date        Time      Version     Size      File name

   2/21/2002   9:22 PM   7.00.1022   4937 KB   Sqlservr.exe
NOTE: Because of file dependencies, the most recent hotfix or feature that contains the preceding files may also contain additional files.


Add the user to one of the initial roles or groups so that the sysusers.roles column value is not a large number.

If you refer to the example mentioned in the "More Information" section of this article, the workaround is to add TestUser to any of the roles between Role0 and Role10.


Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft SQL Server 7.0 Service Pack 4.


The following code segment illustrates the problem.
Use Master
exec sp_addlogin TestUser

---- For each database on the Server (Db0 to Db99)
Use Db0
exec sp_adduser TestUser  

----Add the Roles 0 to 109
declare @x int
declare @y varchar(1000)
set @x = 0
while (@x < 110)
	set @y = 'exec sp_addrole ''role'+convert(varchar(3), @x)+''''
	exec (@y)
	set @x = @x + 1

----Add the User 'TestUser' to the LAST role
sp_addrolemember 'role109', 'TestUser'

----Create Tbl and Proc
create table mytab (col1 int)
create proc myproc as select * from mytab
grant all on myproc to TestUser

----Running Proc in each database causing the database context switches
exec db0.dbo.myproc
exec db1.dbo.myproc
exec db97.dbo.myproc
exec db98.dbo.myproc
exec db99.dbo.myproc
NOTE: Replacing the sp_addrole stored procedure with the sp_addgroup stored procedure and replacing the sp_addrolemember stored procedure with the sp_changegroup stored procedure also causes the same problem.

If you look at the Roles column in the Sysusers table in any of the preceding databases, you can observer the following for TestUser:
When TestUser belongs to Role109:

When TestUser belongs to Role 0 and Role 109:

When TestUser belongs to Role0:

When TestUser belongs to Role0 & Role1:

When TestUser belongs to Role0, Role1, Role2:

When TestUser belongs to Role10:

The server becomes unresponsive when the value of the sysusers.role is a large number (as in the case when the user only belongs to Role109).


Article ID: 318733 - Last Review: October 24, 2013 - Revision: 1.1
  • Microsoft SQL Server 7.0 Standard Edition
kbnosurvey kbarchive kbbug kbfix kbsqlserv700presp4fix kbqfe kbhotfixserver KB318733

Give Feedback


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from