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

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)
SYMPTOMS
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.
RESOLUTION
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 theMicrosoft 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.

WORKAROUND
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.
STATUS
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.
MORE INFORMATION
The following code segment illustrates the problem.
Use Mastergoexec sp_addlogin TestUsergo---- For each database on the Server (Db0 to Db99)Use Db0goexec sp_adduser TestUser  go----Add the Roles 0 to 109declare @x intdeclare @y varchar(1000)set @x = 0while (@x < 110)begin	set @y = 'exec sp_addrole ''role'+convert(varchar(3), @x)+''''	exec (@y)	set @x = @x + 1endgo----Add the User 'TestUser' to the LAST rolesp_addrolemember 'role109', 'TestUser'go----Create Tbl and Proccreate table mytab (col1 int)gocreate proc myproc as select * from mytabgogrant all on myproc to TestUsergo----Running Proc in each database causing the database context switchesexec db0.dbo.myprocgoexec db1.dbo.myprocgo...........exec db97.dbo.myprocgoexec db98.dbo.myprocgoexec db99.dbo.myprocgo				
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:sysusers.role=0x00000000000000000000000000000020When TestUser belongs to Role 0 and Role 109:sysusers.role=0x00000100000000000000000000000020When TestUser belongs to Role0:sysusers.role=0x000001When TestUser belongs to Role0 & Role1:sysusers.role=0x000003When TestUser belongs to Role0, Role1, Role2:sysusers.role=0x000007When TestUser belongs to Role10:sysusers.role=0x00000004				
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).
Properties

Article ID: 318733 - Last Review: 10/24/2013 10:08:47 - Revision: 1.1

  • Microsoft SQL Server 7.0 Standard Edition
  • kbnosurvey kbarchive kbbug kbfix kbsqlserv700presp4fix kbqfe kbhotfixserver KB318733
Feedback