debugsqlMinor
Why database diagrams are not working when domain account is attached to database owner?
Viewed 0 times
ownerwhydiagramsattachedareworkingaccountdatabasewhennot
Problem
I was trying to use Database diagrams is SQL Server and got following error:
I tried to use this command to solve my problem
but it did not help. When I changed my domain account to
I got rid of this error. The question is, why domain account is not acceptable for database owner (it seems that only
Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.I tried to use this command to solve my problem
ALTER AUTHORIZATION ON DATABASE::mydb TO "domain\username"
GObut it did not help. When I changed my domain account to
sa and ranALTER AUTHORIZATION ON DATABASE::mydb TO sa
GOI got rid of this error. The question is, why domain account is not acceptable for database owner (it seems that only
sa annd NT AUTHORITY\SYSTEM are acceptable)?Solution
You don't need to be sa or another sysadmin account to create database diagrams, but I think you may need to do this in order to initially install database diagram support.
If you do this as sa, you should then be able to let domain\username create diagrams. Most of the resources online will tell you that if domain\username is the database owner it should work, but there is a slight difference when you just set a login as the owner of a database and they aren't already a user inside the database: they get mapped to the special dbo account. I seemed to be able to do this in SQL Server 2012, but I used SQL accounts not domain accounts. So I don't know if that's what is causing your issue, but I think I have provided a valid workaround.
If you do this as sa, you should then be able to let domain\username create diagrams. Most of the resources online will tell you that if domain\username is the database owner it should work, but there is a slight difference when you just set a login as the owner of a database and they aren't already a user inside the database: they get mapped to the special dbo account. I seemed to be able to do this in SQL Server 2012, but I used SQL accounts not domain accounts. So I don't know if that's what is causing your issue, but I think I have provided a valid workaround.
Context
StackExchange Database Administrators Q#23127, answer score: 6
Revisions (0)
No revisions yet.