Changing the login name for database user “dbo” …

In some cases, we may face a situation where we see database user “dbo” is mapped to a valid login other than desired or may be mapped to not valid user. Ideally “dbo” should be mapped with sa unless you explicitly want it to be mapped with another login.

You need to execute below command to fix this issue:

Use [data base name]
EXEC sp_changedbowner 'sa' [Replace ‘sa with the login name you want to be mapped to dbo user of the database]

Cause of this issue: Typically database owner is mapped to the user dbo. So you may have any valid login (who is database owner) mapped to user “dbo” automatically. Also if you used a windows login id to create a database (which eventually was database owner) and later deleted that login from windows domain controller, you will end up finding dbo is mapped to unknown login. Those database will also show the owner as “unknown”. This is the reason to make “sa” or a particular designated id to be owner of all databases.

Comments