sql server 提示dbo is not exists解决方法

近期做数据库复杂,遇到一个问题就是
the principal “dbo” does not exist, this type of principal cannot be impersonated, or you do not have permission

查了很多资料,终于找到解决方法

use dbname
exec sp_changedbowner ‘sa’

当然执行这个需要有足够的数据库权限,有sysadmin权限的就OK了.