ERROR:
“Cannot execute as the database principal because the principal “dbo” does not exist, this type of principal cannot be impersonated, or you do not have permission.”
EXPLANATION:
For various reasons, the owner of a database may be deleted or empty. Such an error message may be encountered when there is no owner of a database.
SOLUTION:
You can skip this error if you have a valid owner of the database.
You can use the following command to change the owner of a database:
1 2 3 |
Use MyDatabase GO EXEC sp_changedbowner 'sa' |
1 |
ALTER AUTHORIZATION ON DATABASE::MyDatabase TO sa; |