Click here to Skip to main content
16,022,737 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
My database was running perfectly a few days ago but now I am getting an error whenever I try to open my database.
The error is:

C#
The database first is not accessible. (ObjectExplorer)

------------------------------
Program Location:

   at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.DatabaseNavigableItem.GetChildren()
   at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.SummaryView.get_Items()
   at Microsoft.SqlServer.Management.UI.VSIntegration.AppIDPackage.ListViewVirtualStorage.CopyItems(ISummaryView summaryView)
   at Microsoft.SqlServer.Management.UI.VSIntegration.AppIDPackage.ListViewVirtualStorage..ctor(ISummaryView summaryView, List`1 columnDescriptors)
   at Microsoft.SqlServer.Management.UI.VSIntegration.AppIDPackage.RightPaneListViewer.PopulateView()
Posted
Updated 6-Aug-12 19:16pm
v2

1. Log into SSMS as the user for whom the DB in question isn't accessible.
2. Right-click on the inaccessible DB
3. Click 'Properties'

If you see an error message indicating that a 'Server Principal' does not have access to the DB, re-login as 'sa' and give that 'Server Principal' access to the DB in question ( Logins->{username}->Properties->User Mapping ).

This should open up the DB in question for the user who is getting the 'inaccessible' message.
 
Share this answer
 
Comments
Smrng 7-Aug-12 1:33am    
When I click the properties of the inaccessible database it show following message:


TITLE: Microsoft SQL Server Management Studio
------------------------------

Cannot show requested dialog.

------------------------------
ADDITIONAL INFORMATION:

Cannot show requested dialog. (SqlMgmt)

------------------------------

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

The server principal "APOORVA\Niscair trainee" is not able to access the database "First" under the current security context. (Microsoft SQL Server, Error: 916)
Santhosh Kumar Jayaraman 7-Aug-12 1:38am    
re-login as 'sa' and give that 'Server Principal' access to the DB in question ( Logins->{username}->Properties->User Mapping ).
Smrng 7-Aug-12 2:09am    
Ok will try thanks in advance.The problem is that someone else was using this system before me and I don't know the sa password. I will manage. Thank you :)
What worked for me was as follows:

Right click the Sql Server Management System and click on properties.

Click on Security ,you'll see list of administrators.

Choose admin with maximum rights, click OK.

There you go! :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900