Friday, February 24, 2012

Exporting User/Role Permissions

I am not a DBA so please be gentle...

I am trying to export all of the user and role permissions out of several databases for auditing purposes. I see the Users and Roles listed under the Security tree view when I log into the database, but I do not see an option to export or query the permissions. In addition, we do not have any tables that reference user permissions in our databases. So, how would one go about exporting or querying this information?

I've seen similar topics where they recommend querying sys tables to gather the info, but I don't see those tables either. Any help would be greatly appreciated.

All my thanks!

- Isaac

Edit: I should add in that I am connecting to 7 and 2k DBs using 2k5 SMS. Not sure if that makes a difference...

You can query the tables, such as sys.server_permissions, sys.server_principals, sys.database_principals, sys.database_permissions, to display the permissions of database user and role and logins. E.g., if you want to look at the permission of user Bob, you can query as follows

select * from sys.database_permissions where grantee_principal_id =(select principal_id from sys.database_principals where name='Bob')

No comments:

Post a Comment