Microsoft KB Archive/305711

= BUG: DBO user does not display in Enterprise Manager =

Article ID: 305711

Article Last Modified on 6/6/2005

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition

-



This article was previously published under Q305711





SYMPTOMS
The database owner (dbo) user in a user database is not listed in the Users folder in Enterprise Manager. Additionally, when you view the properties of any login in the Logins folder in Enterprise Manager, you may receive the following error messages:

Error 21776: [SQL-DMO] The name 'dbo' was not found in the Users collection. If the name is a qualified name, use [] to separate various parts of the name, and try again.

This problem only occurs after you apply SQL Server 2000 Service Pack 1 (SP1) to the server. Prior to Service Pack 1, the dbo user displays with a blank Login Name.



CAUSE
Enterprise Manager is incorrectly filtering out all the users that do not have matching logins, and the dbo user does not have a matching login. Two possible reasons for this behavior to occur are:
 * If a database is created by a Microsoft Windows NT authenticated login that is granted access to the computer that is running SQL Server through group membership (such as BUILTIN\Administrators), the security identification number (SID) stored in the sysusers system table in that database does not have a matching SID in the syslogins system table.
 * If a database is restored where the dbo user's SID in the sysusers system table is not matched with the SID in the syslogins system table.



WORKAROUND
If the dbo user does not have an explicit login, change the owner of the database to a user that has an explicit login. For example, change the owner of the database to the system administrator (sa), and then execute the following code: exec sp_changedbowner 'sa'



STATUS
Microsoft has confirmed this to be a problem in SQL Server 2000 Service Pack 1 (SP1).



MORE INFORMATION
To determine if the dbo user is unmatched in a user database, execute the following query: Use 

GO

SELECT u.name AS &quot;Name&quot;, ISNULL(l.name, 'dbo is unmatched') AS &quot;Matched Login&quot;

FROM sysusers u

LEFT JOIN master.dbo.syslogins l ON u.sid = l.sid

WHERE u.name = 'dbo'

GO