April 24, 2014 at 2:02 am
hi
i need to run a script on all databases on a server, the user i want to use doesnt have access to some of the databases
i get the error
The server principal "username" is not able to access the database "database name" under the current security context.
i have tried to use the tables sys.database_permissions and sys.database_principals but i dont have permissions to use those either
is there a way of checking permissions of a database from the master database? or is there another way of checking permissions?
thanks in advance
April 24, 2014 at 5:09 am
bump?
if there was a way to add sysusers to sysdatabases in the master database that would help?
thanks
April 24, 2014 at 6:42 am
I'm afraid, you need to be in 'sysadmin' role to do that. Check 'print user_name()' and see what permissions that login has.
April 24, 2014 at 9:02 am
I've come across this a few times and it's usually down to the authentication process.
Can you ask them to run the following code themselves (assuming they have access via SSMS) ?
SELECT DISTINCT lt.name FROM sys.login_token lt INNER JOIN sys.server_principals sp ON sp.sid=lt.sid
That'll tell you which login details they're using to get authenticated, and there could well be a mismatch somewhere.
[font="Courier New"]sqlmunkee[/font]
[font="Courier New"]Bringing joy and happiness via SQL Server since 1998[/font]
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy