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
 Replication (2008)
 ...and best type of replication for us?

Author  Topic 

glt101
Starting Member

28 Posts

Posted - 2011-08-29 : 17:36:08
Hi,

We have a production server (SQL Server 2008 R2)
whose data we want to replicate to a single test system (likewise
SQL Server 2008 R2).
The test server will have test data placed on it that is not present
on the production server.
After replication, we want the test database to contain both the test
and the all the production server data.
Also after replication, we want the live server database NOT to
contain any production data.

This seems to be a good candidate for Merge replication, but I was
worried that the test data might be merged into the production
database as well.

Cheers,
Geoff

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-08-29 : 17:44:34
This has to be on-going or one-time?

Also, I don't understand this part:
"we want the live server database NOT to contain any production data."

What is the live server? I'm confused by your term there as live server typically means production.


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

Subscribe to my blog
Go to Top of Page

glt101
Starting Member

28 Posts

Posted - 2011-08-29 : 17:48:44
Hi tKizer,

This will be an ongoing replication.

...and that was an awful typo on my part. It should have read:
Also after replication, we want the live server database NOT to
contain any TEST data.

Meaning no data should leak back to the production server from the test server.

Cheers,
[one embarrassed!]
Geoff
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-08-29 : 17:50:50
I would recommend transactional replication for your scenario. Merge doesn't sound right for this.

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

Subscribe to my blog
Go to Top of Page

glt101
Starting Member

28 Posts

Posted - 2011-08-29 : 18:02:31
Hi tKizer,

But wouldn't Transactional replication wipe the Test data
that already existed on the test server?

Cheers,
Geoff
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-08-29 : 18:03:17
Nope, just make to set it up right. If the test data already exists, then "do not initialize" the schema.

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

Subscribe to my blog
Go to Top of Page

glt101
Starting Member

28 Posts

Posted - 2011-08-29 : 18:39:25
OK Tara,

Thanks for the help - we'll give it a shot
(after relevant backups of course!).

Cheers,
Geoff
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-08-29 : 18:40:23
You're welcome, glad to help.

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

Subscribe to my blog
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-08-29 : 23:02:20
I wouldn't likely use transactional replication from production to dev.

The developers are highly likely to break it often, which could have performance impact on the publisher and/or distributor. It also means you'll be re-initializing it often.

I'd choose snapshot replication, nightly, instead. But...snapshot will wipe the test data.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-08-29 : 23:24:00
Yeah that's an important point that I should have addressed rather than just answering the question.

If the developers do break replication by doing something on the test system, replication would start backing up the transaction log in production. This could cause a system outage in production.

What I normally do in a situation like this is just backup/restore and then have scripts to re-apply the test data. But that really depends on how much test data you have.

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

Subscribe to my blog
Go to Top of Page

glt101
Starting Member

28 Posts

Posted - 2011-10-20 : 19:59:12
Hi All,

I didn't get notice of the last 3 replies for some reason,
but thanks for the info. and sorry for this late comment from me.

It appears that transactional replication works at first.
But then I get the error
"The row was not found at the Subscriber when applying the replicated command"

Reading around suggests that the production and test databases are
supposed to be in sync at the start. But that is not what we have.
They will always be different. We just want *new* data added at the
production site to be copied to the development server.

Backing up and restoring the test data is not feasible becuase
the developers are global and are working 24/7. If we overwrite their
new test accounts everyday they will not be happy!

Is there no way to replicate new data to the development side without
wiping what's already there?

Cheers,
Geoff
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-10-20 : 20:09:44
You could specify that only inserts will be replicated. What would you want to do with updates though?

OR...

Backup/restore would be a one-time thing only. And you could do it without very little downtime if you used transaction log backups.

Once the databases are in sync, setup replication, and then you can allow the testers back in.

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

Subscribe to my blog
Go to Top of Page

glt101
Starting Member

28 Posts

Posted - 2011-10-20 : 20:36:00
Hi tkizer,

I see. So there's no way to start the replication wit he databases
out of sync then?

Cheers,
Geoff
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-10-21 : 00:17:03
Yes you can, however you're going to run into those errors like when . You can add an option to skip errors though.

I would recommend starting with a backup/restore to avoid the errors, unless your test team is going to be modifying data. If they are, well that's going to cause issues too.

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 -