onsdag 18 januari 2012

The server principal "user" is not able to access the database "Database" under the current security context.

If you get the following error message in MS SQL 2008:
The server principal "yourUser" is not able to access the database "yourDB" under the current security context

This issue arise due to cross ownership chaining restriction that comes after SQL 2000 SP3.
If cross database ownership chaining is required for your application to work, you must enable it.

How you see if this uis enabled ?
exec sp_dboption ' yourDB ', 'db chaining'

You should get:
OptionName   CurrentSetting
db chaining      OFF

If you are using views to see data in tables owned by different users SQL server check the permissions on the table.




Resources:
Using Ownership Chainshttp://msdn.microsoft.com/en-us/library/aa905173%28SQL.80%29.aspx

Solution
http://blogs.technet.com/b/mdegre/archive/2010/08/29/the-server-principal-quot-sqlloginname-quot-is-not-able-to-access-the-database-quot-mydatabasename-quot-under-the-current-security-context.aspx

Troubleshooting Orphaned Users
http://msdn.microsoft.com/en-us/library/ms175475.aspx

PRB: "Troubleshooting Orphaned Users" Topic in Books Online is Incomplete
http://support.microsoft.com/kb/274188/

sp_addlogin (Transact-SQL)
http://msdn.microsoft.com/en-us/library/ms173768.aspx

Inga kommentarer:

Skicka en kommentar