0

Is there something that I am missing?

Newly created database with 2 users. Both have the same permissions. SQL01 gets error "The database DB01 is not accessible" on browsing through SSMS.

No login failures in SQL errorlog.
No user error message thrown in a profiler trace.
user's default database is set to master
SQL01 can access other database on the same instance.

ssms error

USE DB01; --throws error

The server principal "DOM\SQL1" is not able to access the database "DB01" under the current security context.

5
  • What is the additional error info from the "show details" link? What error do you get when you execute USE DB01; from a query window?
    – Dan Guzman
    Sep 13 at 11:04
  • Don't have the additional info from "show details". USE DB01; throws 'The server principal "DOM\SQL1" is not able to access the database "DB01" under the current security context.' Sep 13 at 11:07
  • Add the script you ran to list permissions to your question. There may be a DENY involved where DOM\SQL1 is a member of a Windows group that DOM\SQL2 is not.
    – Dan Guzman
    Sep 13 at 11:15
  • This is the script i used github.com/sqlstudent144/SQL-Server-Scripts/blob/master/…. Went though all the groups DOM\SQL1 is part of, Couldn't find a DENY. SQL01 and SQL02 are the only 2 users in the database. It is also a blank new database. Sep 13 at 11:20
  • 1
    Can you try a minimal script to reproduce the issue? CREATE DATABASE Test; GO USE Test: CREATE USER [DOM\SQL1]; CREATE USER [DOM\SQL2]; GO
    – Dan Guzman
    Sep 13 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.