views:

45

answers:

1

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 ?

+1  A: 

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
ntziolis