Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I want to set one of the Active Directory users I have in my database as the owner of the database. But I know this user is used on many scripts and Excel pivot tables.

Now if I delete the user from the database and set it as dbo, will those scripts still work?

Thank you!

share|improve this question
    
What do you mean by "set it as DBO"? Why not just add the user to the db_owner role? (Or just give the user the exact rights they need, instead of blanket "they can do everything"?) –  Aaron Bertrand Jun 3 at 13:17
    
I mean set it as Database Owner. When I try to change the database owner (db_owner role) I get an error saying that the username currently exists as a user. So the way I have to do it, from what I found, is to delete the user and add it again as database owner. The reason I want to set it as the owner and give the user all rights is because right now the owner of the database is the old DC admin account, which does not exist anymore, and I want to update it to the new one. So it needs to be able to do everything. –  dlalonde Jun 3 at 14:30
2  
Database owner and db_owner role are two different things altogether. You set database owner (there can only be one) using ALTER AUTHORIZATION ON DATABASE::dbname TO [LoginName]; - this is a server-level login, not a database-level user. You add a database-level user to the db_owner role using ALTER ROLE db_owner ADD MEMBER [UserName];. Personally, I think you should be adding the database-level user to the db_owner role, and changing the authorization on the database to sa. –  Aaron Bertrand Jun 3 at 14:37
3  
sigh that is the opposite of what I said. –  Aaron Bertrand Jun 3 at 15:57
2  
@dlalonde - Just for your clarity. Aaron said: "You set database owner (there can only be one) using ALTER AUTHORIZATION ON DATABASE::dbname TO [LoginName]". This means that the Database Owner becomes the dbo user in the database it owns. (Of course, you can have many users as members of db_owner, but only one dbo user.) –  RLF Jun 3 at 17:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.