views:

874

answers:

7

We are using Replication and seem to be having endless problems with it. It seems to shut down for unknown reasons. It needs to be shut down to remove a column and only starts back up half the time. Does anyone have any advice on how to properly use replication or some alternatives to it.

Edit:

We are using Sql Server 2005, We cannot use database mirroring as we used the other database for reporting. As far as I am aware you cannot query from a mirrored database.

A: 

What version of SQL Server are you using?

We're using replication now for a particular solution, and it seems to just work, day in, day out.

I would examine your event log's, and SQL Server logs to see if you can determine why it is shutting down, and why it doesn't start up. Are you possibly patching the servers, or are you having network errors?

The alternatives to replication are log shipping, or database mirroring. I personally prefer Database Mirroring, but it really depends what you're trying to do, as some of these aren't appropriate for certain situations.

Bravax
+3  A: 

If you need just couple of tables from your DB for reports, replication is more useful, but you also can set up log shipping with secondary server in STAND BY mode (especially if you need significant part of your data for reports), then you can run reports on secondary server. You just have to remember that log shipping will interfere with transaction log backups, so you have to use the same folder with log backup files for both processes.

Irina C
+1  A: 

Here are a list of the problems that I have had to resolve to get replication working:

1) The replication sometimes lies to me and tells me this, even when its working fine. "The server 'Bob' is not a Subscriber. (.Net SqlClient Data Provider)" I have tried to re-initialise it thinking that it was broken and it never was...

2) It can take a little while to restart itself, especially if your remote DB is on the other side of the planet, which it is in my case. If you are on a slow network connection, or it is not 100% reliable, then you can have problems. Also, the jobs which restart the process can sometimes take a while to run, which also delays things further.

3) Some changes require full re-initalisation which involves sending a new snapshot out. If you don't have your permissions quite right, and you can re-initialise manually, but it doesn't happen automatically, then this can be a another reason for problems.

GordyII
+2  A: 

I would think the combination of database mirroring and database snapshots will solve your issues.

First, database mirroring is very easy to setup and I have never had any problems with it (using it for the past 4+ years).

Second, creating a database snapshot on your failover server will allow you to run reports. You can setup a sql agent job to drop and re-create the snapshot on whatever acceptable interval you like.

Of course this is all dependent on if you need your reports to run on real-time data or if they can be delayed somewhat.

Jason Cono
+1  A: 

We have a SQL transactional replication which runs perfectly happily. You seem to say that it is when you are making schema changes to the publisher that you get problems. Each time we do a schema change we drop the publication, subscription and the subscription database. Do the change, then re-build it all. We can do this becuase we can tolerate the time it takes to re-apply the snapshot. There are ways to apply schema changes to the publication and have them propogate to the subscriber. Take a look at sp_register_custom_scripting. We have made this work once, so I can give some more information about it if you need.
As @Jason says, you can report from a mirrored database by using a snapshot. Beware that the snapshot will take up space, and cause more work for the mirror server. Although how much space will depend on how much data is changing and how big your original database is. We do use a snapshot on a mirrored database for occasional reports because our entire database is not replicated.

pipTheGeek
+1  A: 

log shipping http://msdn.microsoft.com/en-us/library/ms187103.aspx

Chad Grant
yep. We had MS fix SQLServer for us when it hung (one server went down, the other stayed as secondary). In the end we still went to log shipping for the reliability we required.
gbjbaanb
A: 

We also have used SQL transactional replication. We had the same pains with updating schema, which requires dropping the publication on all servers, performing the updates, and then reinitializing replication, and hoping for the best. Sometimes it would not initialize, or a node would fall behind and we'd get little warning for it. A few times we even lost all the stored procedure execute permissions causing pretty much total failure on the websites.

We have a rather large database so reinitialization could take quite some time, meaning all updates had to be done at 2am on Sunday - not exactly when we're awake and alert and able to use all our faculties to deal with a problem that might arise.

We are ditching replication in favor of failover clustering on SQL 2008, but it can still be done all the way back to SQL 2000.

http://technet.microsoft.com/en-us/library/cc917693.aspx

David