I restored a backup of a database from SQL Server 2008 R2 to SQL Server 2012.

When I try to access a particular page of my application, I get this error:

Cannot execute as the database principal because the principal "dbo" does not exist

It works with my 2008 R2 project perfectly. How can I resolve this issue?

  • 1
    The solution that worked for me was ALTER AUTHORIZATION ON DATABASE::[<dbname>] TO [sa]; as noted on the question that is stated above as the original of this duplicate.
    – isapir
    Commented Dec 9, 2016 at 21:07

1 Answer 1


You need to give the database a valid owner. Use the ALTER AUTHORIZATION command to do this:

ON DATABASE::[DatabaseName]
TO [A Suitable Login];

Related Knowledge Base article

Note the sp_changedbowner system stored procedure has been deprecated in favour of ALTER AUTHORIZATION.


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