I am getting the following error
Cannot execute as the database principal because the principal \"dbo\"
does not exist, this type of principal cannot be imp
If the above does not work then try the following. It solved the problem for me even when the owner was well defined for the database.
SQL Server 2008 replication failing with: process could not execute 'sp_replcmds'
USE [<dbname>]
GO
sp_changedbowner '<user>' -- you can use 'sa' as a quick fix in databases with SQL authentication
KB913423 - You cannot run a statement or a module that includes the EXECUTE AS clause after you restore a database in SQL Server 2005
As the message said, you should set permission as owner to your user. So you can use following:
ALTER AUTHORIZATION
ON DATABASE::[YourDBName]
TO [UserLogin];
Hope helpful! Leave comment if it's ok for you.
Under Security, add the principal as a "SQL user without login", make it own the schema with the same name as the principal and then in Membership make it db_owner.
another way of doing it
ALTER AUTHORIZATION
ON DATABASE::[DatabaseName]
TO [A Suitable Login];
Also had this error when accidentally fed a database connection string to the readonly mirror - not the primary database in a HA setup.