I receive this error message: "The server principal A is not able to access the database B under the current security context (Microsoft SQL Server, Error:916)"


The error:

The server principal A is not able to access the database B under the current security context (Microsoft SQL Server, Error:916)

The issue:

This issue occurs with SQL Server 2008 RC0 tools. Using SQL authentication, I could connect to database engine but I could not expand the ‘Databases’ node. It would result in the error above. The issue is with SQL Server Management Studio itself, not the database engine or any other aspect of SQL Server. I could connect to the SQL installation from another server running SQL Server 2008 RC0, using SQL authentication, and expand the ‘Databases’ node without any errors. But I couldn’t connect locally using SQL authentication.

In a nutshell:

Server A – While logged in locally on Server A, I could not connect and expand the ‘Databases’ node successfully using SQL authentication.

Server B – I could connect to the SQL instance on Server A and expand the ‘Databases’ node using SQL authentication successfully.

Based on my current understanding of the issue at hand, there are several work-a-rounds to correct this issue. Hopefully, one of them will work for you.

Work around #1:

1.Within SQL Server Management Studio, view Object Explorer Details window by selecting View, Object Explorer Details in menu (or hitting F7)
2.Right-click on the column header and unselect Collation.
3.Refresh the server in Object Explorer and enumerate the databases

Work around #2:

1.Within SQL Server Management Studio, view Object Explorer Details window by selecting View, Object Explorer Details in menu (or hitting F7)
2.In Object Explorer window click at Databases folder
3.In Object Explorer Details window right-click at the column header and select ‘Reset view’.
4.Refresh Databases folder

Work around #3:

1.Check the database options for the "Auto Close” setting. If it is set to "True,” change it to "False” and test again.

Further explanation:

Collation for an offline database is returned as NULL by the engine, and SSMS currently interprets NULL values as a permissions issue. The error will occur even if Object Explorer Details view is not open. The same issue will occur if you try to enable a setting that you dont have permission to access on all databases, for example data space used.

Other helpful links:
https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=355238
http://sqlblog.com/blogs/aaron_bertrand/archive/2008/07/07/a-little-management-studio-oops.aspx
https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=354322
https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=354291&wa=wsignin1.0



Article ID: 42
Created On: Mon, Apr 30, 2012 at 11:57 PM
Last Updated On: Mon, Apr 30, 2012 at 11:57 PM
Authored by: ASPHostServer Administrator [asphostserver@gmail.com]

Online URL: http://faq.asphosthelpdesk.com/article.php?id=42