无法作为数据库主体执行(MS SQL服务器错误15517) [英] Cannot execute as the database principal (MS SQL server error 15517)

查看:870
本文介绍了无法作为数据库主体执行(MS SQL服务器错误15517)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我有一个小数据库(.mdf)文件,我在SSMS中附加,以便我可以在对象资源管理器中看到这些表。但是,我无法为此数据库创建数据库关系图,每次尝试执行此操作时都会收到错误。所以我无法建立任何关系或执行任何行动。



错误:无法作为数据库主体执行,因为主体dbo不存在。这种类型的委托人不能被冒充,或者您没有获得许可。 (MSSQL Server错误15517)





在Visual Studio中,我可以将数据库作为ADO.Net实体框架模型打开,但不能创建任何那里的关系。所以,数据库是一组不相关的表,或多或少没用。



任何有建设性的建议都会有所帮助。



谢谢。



我的尝试:



我已经多次重新创建了表,但是没有从头开始重新创建数据库。

Hello,

I have a small database (.mdf)file which I attached in SSMS so that I can see the tables in the Object Explorer. However I am unable to create Database Diagram for this database and I receive and error each time I attempt to do that. So I can't establish any relationships or perform any action.

ERROR: Cannot execute as the database principal because the principal "dbo" does not exist. This type of principal cannot be impersonated or you don not have permission. (MSSQL Server Error 15517)


In Visual Studio I can open the database as an ADO.Net Entity Framework Model but cannot create any relationships there either. So, the database is a group of unrelated tables, that are more-or-less useless.

Any constructive suggestions would be helpful.

Thanks.

What I have tried:

I have recreated the tables several times, but have not entirely recreated the database from scratch.

推荐答案

尝试将数据库所有者提供给您的数据库。这解决了我过去的错误。



如果仍然出现错误,请检查以下主题,如果这些有助于解决您的问题 -

sql server - 无法作为数据库主体执行,因为主体dbo不存在 - 数据库管理员堆栈交换 [ ^ ]

sql server - 无法作为数据库主体执行,因为主体guest不存在 - 数据库管理员堆栈交换 [ ^ ]





希望,它有助于:)
Try giving a database owner to your database. That resolves the error for me in the past.

If you still get error, please check following threads, if these help resolve your issue -
sql server - Cannot execute as the database principal because the principal "dbo" does not exist - Database Administrators Stack Exchange[^]
sql server - Cannot execute as the database principal because the principal "guest" does not exist - Database Administrators Stack Exchange[^]


Hope, it helps :)


这篇关于无法作为数据库主体执行(MS SQL服务器错误15517)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆