Server unable to access database under current context

  • swarm

    SSC Eights!

    Points: 976

     Hi guys. I created a database "MyDatabase" using an AD Account "user01" which is a member of a domain group "GroupA". I have created a login in my SQL Server 2005 for this AD group. I have also added the said login as a user of my database. I created other AD users and put them in the same group. When I try to access the database using the other users, I get this message

    The server principal "MyDomain\user02" is not able to access the database "MyDatabase" under the current security context.

    This KB tells me that my situation is triggered by the first case in which the owner of the database is windows authenticated. I have already set the database to be TRUSTWORTHY. I haven't tried CERTIFICATES though. I believe I haven't done anything complex to warrant this solution.

    I'm really lost with the myriads of principals and securables that SQL2005 has. All I want is just to execute a certain set of stored procedures. I can't do this because I can't even execute "USE MyDatabase". What are the permissions I need to give to "GroupA" ?


    "The way to get things done is not to mind who gets the credit for doing them." - Benjamin Howett

  • swarm

    SSC Eights!

    Points: 976

    Made this work per suggestion of an MS guy. The behavior is due to the fact that the owner of the database is not a local account that belongs to the sysadmin account. I recreated the db using the local administrator and the problem is gone.


    "The way to get things done is not to mind who gets the credit for doing them." - Benjamin Howett

  • Flávio Gaspar

    Old Hand

    Points: 302

    it work for me 😎

  • zavhrye

    SSC Veteran

    Points: 216

    instead of recreating the database you may also change the db owner in of the database to the username you are using.

  • mike.towery

    SSC Journeyman

    Points: 97

    Grant connect to the user under the database properties

  • mark.harby

    SSC Enthusiast

    Points: 158

    Changing the database owner (Properties->Files->Owner) sorted the problem for me.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply