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?
You need to give the database a valid owner. Use the [`ALTER AUTHORIZATION`] command to do this:
TO [A Suitable Login];
[Related Knowledge Base article]
Note the [sp_changedbowner] system stored procedure has been deprecated in favour of `ALTER AUTHORIZATION`.