SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Reassigning the ownership of db_owner


Reassigning the ownership of db_owner

Author
Message
Rod
Rod
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2668 Visits: 2057
We're recently purchased some new software, which requires its own SQL Server database. Working with the vendor they also needed to have a new SQL account created which would be a part of the db_owner database role membership. Creating new SQL accounts isn't something we do often (I cannot remember when I last created a new SQL account), so I made a mistake when I set the new user up. Here's what happened:

First, I created the new database. After setting it up, assigning the .mdf and .ldf files to their appropriate places, I then created the new SQL account, and in the property page for creating the new user, I checked db_owner under the "Schemas owned by this user", rather than "Database role membership".

Later I realized my mistake, but I'm not sure how to fix it. First of all, what account normally has ownership of the db_owner schema? I would assume it would be the sa account, especially for a new database like this one, but I want to ask anyway.

Second, how do I reassign the db_owner schema from this new SQL account to the account it should really be owned by?

Kindest Regards,Rod
Connect with me on LinkedIn.
Greg Charles
Greg Charles
SSCertifiable
SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)

Group: General Forum Members
Points: 5453 Visits: 5925
Usually, the fixed database roles are owned by dbo. Check the properties of some of the other roles in the database e.g. db_securityadmin, db_ddladmin, etc. You can change the owner of a role by opening the properties of the role in object browser and either typing in the new owner or clicking on the elipse and choosing the new owner from the list.

Greg
Ken Jr.
Ken Jr.
Mr or Mrs. 500
Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)

Group: General Forum Members
Points: 598 Visits: 1075
The default owner of the db_owner Schema is dbo. Use this to change it back.
USE [DatabaseName]
GO
ALTER AUTHORIZATION ON SCHEMA::[db_owner] TO [dbo]
GO
Rod
Rod
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2668 Visits: 2057
Thank you Greg and Kenneth, that did the trick for me.

Kindest Regards,Rod
Connect with me on LinkedIn.
ganteng1
ganteng1
SSC Journeyman
SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)

Group: General Forum Members
Points: 91 Visits: 80
Hi there. I have a user I could not delete because they were a db_owner. I used the following alter statement and after that was able to delete them. The statement was as follows:

ALTER AUTHORIZATION ON SCHEMA::db_owner TO dbo;

My question is should it be the following below:

ALTER AUTHORIZATION ON SCHEMA::db_owner TO dbo_owner;

Thanks for your help
Ken Jr.
Ken Jr.
Mr or Mrs. 500
Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)

Group: General Forum Members
Points: 598 Visits: 1075
You are correct. It should be dbo not db_owner. I'll update my earlier post.

Thanks!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search