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

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 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.

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 Master
go
exec sp_addlogin TestUser
go

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

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

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

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

----Running Proc in each database causing the database context switches
exec db0.dbo.myproc
go
exec db1.dbo.myproc
go
...........
exec db97.dbo.myproc
go
exec db98.dbo.myproc
go
exec db99.dbo.myproc
go
				
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=0x00000000000000000000000000000020

When TestUser belongs to Role 0 and Role 109:
sysusers.role=0x00000100000000000000000000000020

When TestUser belongs to Role0:
sysusers.role=0x000001

When TestUser belongs to Role0 & Role1:
sysusers.role=0x000003

When TestUser belongs to Role0, Role1, Role2:
sysusers.role=0x000007

When 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: October 24, 2013 - Revision: 1.1
APPLIES TO
  • Microsoft SQL Server 7.0 Standard Edition
Keywords: 
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 smallbusiness.support.microsoft.com