Permissions issue upon a restore

  • Every now and then when we restore production databases in development environment we get a few emails from developers complaining about that they are unable to do something or just cant log in to the database. Those that we remember to give permissions to are happier but those we forget or just are left out just aren't happy. I don't blame them because there is a hole in our process.

    I was wondering if there is a script that can help me extract all the permissions from an existing database in development environment, whether the permissions are at the object level (table, view) or whether at the role level (dbo, db_reader etc.) so every time after the restore from Prod I can just run this script of permissions and keep everyone happy.

    Thoughts?

    Thanks

  • I have proc that will script out all the users, roles and their permissions if you want it.

    But I would make two other suggestion which would be simpler:

    1) import the logins from the production server to the development server then you won;t have to worry about it anymore.

    2) if you can't do that, always remeber to run sp_change_users_login for the SQL serve logins after you restore your production database.

    The probability of survival is inversely proportional to the angle of arrival.

  • Infact the issue that we run into most often is that some of these folks in prod have db_reader access whereas in dev they want full control as dbo so they can do whatever it is that would like. So my goal is to extract permissions from dev environments and just re-apply them after the restore.

    Would you be kind enough to share your script.

    Thanks

  • yes I can, but from what you are describing, scripting out the roles and permissions from production and executing it on the dev server will not give you what you want (users having more permissions on dev)

    Would it not be easier to simply run a pre-built script that has your necessary grant statements and/or sp_addrolemember SP calls?

    The probability of survival is inversely proportional to the angle of arrival.

Viewing 4 posts - 1 through 3 (of 3 total)

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