Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Permissions issue upon a restore Expand / Collapse
Author
Message
Posted Wednesday, February 20, 2013 8:10 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Sunday, August 4, 2013 11:06 AM
Points: 397, Visits: 548
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
Post #1422104
Posted Wednesday, February 20, 2013 8:16 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: 2 days ago @ 11:25 AM
Points: 1,426, Visits: 3,224
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.
Post #1422111
Posted Wednesday, February 20, 2013 8:37 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Sunday, August 4, 2013 11:06 AM
Points: 397, Visits: 548
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
Post #1422119
Posted Wednesday, February 20, 2013 8:45 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: 2 days ago @ 11:25 AM
Points: 1,426, Visits: 3,224
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.
Post #1422125
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse