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.

We have a few SQL Server 2008 R2 databases where its member domain was changed (i.e. it was connected to DOMAINA and is now on DOMAINB). We have three databases where the owner of the database is DOMAINA\User, which no longer exists.

I have tried logging on to SQL Server as DOMAINB\Administrator and sa and run the following command:

ALTER AUTHORIZATION ON DestDB TO sa

Error:

Msg 15151, Level 16, State 1, Line 1
Cannot find the object 'DestDB', because it does not exist or you do not have permission.

I was under the (obviously incorrect) assumption that sa could do virtually anything on the server.

How can I get ownership of these databases back?

share|improve this question

1 Answer 1

up vote 10 down vote accepted

The syntax you're using is attempting to change ownership of the object 'DestDB' within whatever database context you're currently in. You need to specify that you're changing database ownership by using the class definition:

ALTER AUTHORIZATION ON DATABASE::[DestDB] TO [sa]

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.