views:

346

answers:

3

Often I need to pull the production database of some project to my local sql server to add features, test out stuff etc.

Today my procedure is to create a backup on the production server, somehow get that to my local machine - and then create a new database locally and restore the backup on top of that.

It is a pain, and takes more time than I like - and I would like to think, there must be a better way.

I have access via SQL Server Management Studio to the production database - isn't there an easier way, that requires fewer manual steps?

How do you do it?

A: 

Backup and Restore is slow for my databases, so what I do is: 1. Detach production database 2. Copy files to my dev machine 3. Attach database to dev server.

but no body should work on the production database.

My backup procedure is similar - I am detaching the database and archive the files, it is faster than backing up.

dbrmr
Maybe I am misunderstanding something, but... If you detach your production database, does that not mean it is offline??
Kjensen
-1 for putting the database offline just to make a backup
Rodrigo
Ok then, how can I backup and archive fast ?
dbrmr
Kjensen: Yes it is offline.
dbrmr
A: 
  • You can use SSIS and copy objects between these environments, assuming you have a direct connection to the production server.
  • Another way, it's a must to make regular backups of the production databases, a simple maintenance plan can make a full backup at night, by example. If this is the case here, just request an early backup to the administrators and then mount it into your environment.
  • One more way, because production data disclosure can involve legal issues, you can just extract the database schema and then use testing data to make any development. This is also the fastest way to get a database.
Rodrigo
What specific functionality are you talking about?
Kjensen
Fixed the formatting to better reading
Rodrigo
+2  A: 

Can't think of a quicker way using SQL Sever Management Studio. I'd recommend SQL Compare from Red Gate for synchronising the schema, SQL Data Compare can sync the data, but it's not quick for large databases over the internet.

Nick
I use Red Gate SQL Compare and SQL Data Compare regularly. If only they were ONE app, so I would not have to spin up two apps, set up two connections (or find them saved earlier) - and then do the compare-and-sync dance twice.
Kjensen
I guess one app would be handy, I usually find schema changes go from dev to live, and data changes the other way, so I only need one or the other. Otherwise I'd go the backup route..
Nick

related questions