Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I got this error from another person and I've run out of ideas. I can access this database without any problems, the database is in MULTI_USER mode, the person receiving the error is a user, etc.

The database is READ_ONLY and the user in question has previously used this database and only has database read permissions, so there's no chance of settings being tampered with.

Yesterday, I added a few functions and had to set to SINGLE_USER and READ_WRITE, but I've triple checked that the db has been set back to MULTI_USER. I can't decide if that's coincidence or causality. Either way, I'm at a dead end.

Here's the error report:

The database [dbName] is not accessible. (Object Explorer)

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

    at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.DatabaseNavigableItem.get_CanGetChildren()
    at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItem.RequestChildren(IGetChildrenRequest Request)
    at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ExplorerHierarchyNode.BuildChildren(WaitHandle quitEvent)

Any experience with this kind of error?

share|improve this question
    
Did you try to let the user logon from your machine? If he/she could, then there is something different at the user's machine setting and not in the database. –  Emmad Kareem Aug 1 '12 at 14:55
    
I had him log in directly to the server and try to query from SSMS there, but he gets the same error. –  Davenport Aug 1 '12 at 15:01
    
So it looks like its this user's permissions with this database. May be you want to check his permissions. –  Emmad Kareem Aug 1 '12 at 15:08
    
Have you checked that the database is online and that the auto-close setting is not enabled? Have you double-checked their connection string? –  Aaron Bertrand Aug 1 '12 at 15:46
    
By any chance, does the user have a "default database" set to a db that's offline/detached? I've been burned by that... –  Bob Aug 1 '12 at 16:48
show 1 more comment

migrated from stackoverflow.com Aug 1 '12 at 14:28

This question came from our site for professional and enthusiast programmers.

2 Answers

Typically this is caused when the user's default database is set to a database they don't have permissions in, or it's offline.

For example, say I set you up a login in the Sales database, and then I right-click on your login in SSMS and change your default database to master - but you don't have any permissions in Master. When you try to connect, even though you want the Sales database, you'll go into Master by default, and get this error.

This can also happen if someone takes away your permissions in Sales and doesn't change your default database to something else.

This is why I love setting all users' default databases to TempDB. User databases can come and go, but TempDB will always be there. Plus if somebody accidentally creates an object, at least it's in a throwaway database instead of something like Master or Sales.

share|improve this answer
add comment

I was getting this error for some users. We tried many things. Finally, I just removed and re-added the user, and then they were able to see the databases.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.