Changing the DBO to Sa
Richard Waymire answers a reader’s question about sa mapping to DBO.
October 23, 2001
When I look at Enterprise Manager or execute sp_helpdb '' for a particular database, the database owner (DBO) appears to be a Windows NT user who hasn't been added to the SQL Server 7.0 server logins. (This NT user is a member of the local NT administrator group.) However, when I execute
USE EXEC sp_helpuser
the result shows that sa maps to the user DBO, which to me means that sa is the DBO. Therefore, the statement
EXEC sp_changedbowner 'sa'
would fail because SQL Server thinks that DBO is the database owner. Who is the DBO—the NT user or the sa? If the NT user is the owner, how can I change the DBO to sa?
Sa is always mapped to DBO, even when sa isn't the real DBO. The DBO is the login that the sysdatabases system table in the master database displays, as sp_helpdb shows. Yes, you can change the DBO to sa from the NT login. The fastest way is to detach the database, then reattach it while you're logged in as sa. Note that this method will create downtime.
About the Author
You May Also Like