恢复 SQL Server 备份时出现问题

发布于 2024-08-29 18:58:51 字数 364 浏览 4 评论 0原文

我有一个 SQL Server 2008,它是的一部分。现在,我对此服务器的数据库进行备份,并将其恢复到不属于域的 SQL Server 上。 我有一个使用此数据库的C# 应用程序。在非域计算机上,我现在收到如下异常:

“无法作为数据库主体执行,因为主体“dbo”不存在,这种类型的主体不能被模拟,或者您不没有权限”

我认为,问题是,数据库所有者域用户,并且该用户在目标计算机上不存在(备份机)!?我该如何解决这个问题?

I have a SQL Server 2008, which is part of a domain. Now I make a backup of a database of this server and restore it on a SQL Server, which is not part of a domain.
I have an C# application, which uses this database. On the NON-Domain machine I get now exceptions like this:

"Cannot execute as the database prinzipal because the principial "dbo" does not exist, this type of principal cannot be impersonatedm or you don not have the permission"

I think, the problem is, that the database owner is a domain user and this user doesn't exist on the target machine (backup machine)!? How can I solve this ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉墨 2024-09-05 18:58:51

MS SQL 服务器遵循 2 层用户系统。
您必须确保您的登录名是 SQL Server 上的实际登录名(这是指 SQL Server 本身而不实际数据库的登录名)。

您可以在 Management Studio 中的以下位置找到 SQL Server 用户:
服务器根->安全性 - 登录

确保您的登录可用后,您必须将其映射到用户/架构。为此,您必须:

  1. 选择要映射的 SQL Server 用户
  2. 右键单击​​该用户
  3. 选择属性
  4. 切换到“用户映射”选项卡
  5. 选择要为其创建映射的数据库
  6. 选择数据库用户您想要将当前选定的 SQL Server 用户与
  7. “完成”相关联

The MS SQL server follows a 2 layer user system.
You must make sure that your login is an actual login on the SQL Server (this refers to the SQL Server itself NOT to the actual database).

You find the SQL Server users in the Management Studio under:
Server root -> Security - Logins

After you ensured that your login is available you have to map it to a user/schema. In Order todo so you must:

  1. Select the SQL Server user you want to map
  2. Right click on the user
  3. Select properties
  4. Switch to the User Mapping tab
  5. Choose the database you want to create a mapping for
  6. Select the Database user you want to associate the currently selected SQL Server user with
  7. Done
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文