Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 refresh database from prod to dev sql server 2008

Author  Topic 

Peter99
Constraint Violating Yak Guru

498 Posts

Posted - 2012-06-01 : 14:40:49
Hi,

I want to restore database from prod to dev. Problem is that how to keep existing users and their permissions on dev. Any script to do it. I just want to keep/restore users with permission which they already have in dev not from prod. Any help will be appreciated.

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-06-01 : 14:44:41
Generate the script on dev via SSMS to grab the permissions and run that script after the restore. I have a post-restore script that I run on all non-prod environments that handle permissions.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Peter99
Constraint Violating Yak Guru

498 Posts

Posted - 2012-06-01 : 15:06:10
Hi Tara,
I right clicked on dev database, selected task and generate scripts, then selected specific database objects and selected uses. That will script out all user statement like create user .... for login .... default_schema ....
My question is whether permission will remain same once I run this script on dev after post restore.
Thanks
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-06-01 : 16:40:41
My point is that you've got some work to do to create the post-restore script. Use dev to create the script. Yes you'll need to do a lot of editing.

As long as your script is correct, yes it will be the same after the script runs.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -