SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Fastest Refresh of a Database


Fastest Refresh of a Database

Author
Message
steveg5000
steveg5000
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 7
What is faster, doing a backup of a database, then sending the file over the network and restoring it to a dev database or doing a detach, copying the detached MDF file and attach to the dev db?

The purpose is simply to copy a prod database to a dev database (refresh).

Assume 2016 standard edition.
Ed Wagner
Ed Wagner
SSC Guru
SSC Guru (191K reputation)SSC Guru (191K reputation)SSC Guru (191K reputation)SSC Guru (191K reputation)SSC Guru (191K reputation)SSC Guru (191K reputation)SSC Guru (191K reputation)SSC Guru (191K reputation)

Group: General Forum Members
Points: 191478 Visits: 11908
steveg5000 - Tuesday, December 26, 2017 9:58 AM
What is faster, doing a backup of a database, then sending the file over the network and restoring it to a dev database or doing a detach, copying the detached MDF file and attach to the dev db?

The purpose is simply to copy a prod database to a dev database (refresh).

Assume 2016 standard edition.

They aren't functionally the same because detaching a production database so you can copy the files takes the production database offline.

I use the backup, copy and restore approach when doing this type of thing. If you use SQL Server logins, you'll probably have a SID mismatch between the users and the logins on the destination server because the start of authority is the instance. You can use sp_change_users_login to find and fix them. If the servers are on the same domain, the AD logins should be fine because the start of authority is the domain.



Tally Tables - Performance Personified
String Splitting with True Performance
Best practices on how to ask questions
RandomStream
RandomStream
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1671 Visits: 638
Backup with compression, copy over and restore.
HappyGeek
HappyGeek
SSCrazy Eights
SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)

Group: General Forum Members
Points: 9012 Visits: 5718
To be controversial, Don:t do either with the caveat of 'if it contains data pertaining to an individual or an identifiable individual', if this is the case I would script all objects and send that to the dev team.
To distribute data otherwise may put you in breach of regulations, this is more important than ever given the forthcoming GDPR regulations.
If data is needed generate test data.

...
Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (274K reputation)SSC Guru (274K reputation)SSC Guru (274K reputation)SSC Guru (274K reputation)SSC Guru (274K reputation)SSC Guru (274K reputation)SSC Guru (274K reputation)SSC Guru (274K reputation)

Group: General Forum Members
Points: 274001 Visits: 41203
Or, have scripts that you run against the database to obfuscate the data immediately after the restore.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Ed Wagner
Ed Wagner
SSC Guru
SSC Guru (191K reputation)SSC Guru (191K reputation)SSC Guru (191K reputation)SSC Guru (191K reputation)SSC Guru (191K reputation)SSC Guru (191K reputation)SSC Guru (191K reputation)SSC Guru (191K reputation)

Group: General Forum Members
Points: 191478 Visits: 11908
Lynn Pettis - Friday, January 5, 2018 7:52 AM
Or, have scripts that you run against the database to obfuscate the data immediately after the restore.

Yes, definitely this.



Tally Tables - Performance Personified
String Splitting with True Performance
Best practices on how to ask questions
HappyGeek
HappyGeek
SSCrazy Eights
SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)

Group: General Forum Members
Points: 9012 Visits: 5718
Lynn Pettis - Friday, January 5, 2018 7:52 AM
Or, have scripts that you run against the database to obfuscate the data immediately after the restore.

+100 have done this in the past, not sure if this approach would be affected by GDPR though!


...
ManicStar
ManicStar
SSCrazy Eights
SSCrazy Eights (9.2K reputation)SSCrazy Eights (9.2K reputation)SSCrazy Eights (9.2K reputation)SSCrazy Eights (9.2K reputation)SSCrazy Eights (9.2K reputation)SSCrazy Eights (9.2K reputation)SSCrazy Eights (9.2K reputation)SSCrazy Eights (9.2K reputation)

Group: General Forum Members
Points: 9225 Visits: 5311
HappyGeek - Friday, January 5, 2018 8:29 AM
Lynn Pettis - Friday, January 5, 2018 7:52 AM
Or, have scripts that you run against the database to obfuscate the data immediately after the restore.

+100 have done this in the past, not sure if this approach would be affected by GDPR though!

We do this too, esp for prod - to -dev environment refreshes.

Nadrek
Nadrek
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12823 Visits: 2752
Lynn Pettis - Friday, January 5, 2018 7:52 AM
Or, have scripts that you run against the database to obfuscate the data immediately after the restore.

Note that you need to bring the restored database up in restricted_user mode and make sure that no non-DBA's have sysadmin permissions; that way you can guarantee the data changes are complete before you put it into multi_user mode and others can get at the data.

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search