Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the best way to replicate database for SSRS

I have installed SQL server database (mainserver) in one instance and SQL server database for RerportServer in others. what is the best way to replicate data from mainServer to report Server? Data in mainServer changes frequently and actual information in the ReportSever is very important.

And there is many ways to do this:

  • mirroring
  • shipping log
  • transactional replication
  • merge replication
  • snapshot replication

are there some best-practices about this? Thanks

like image 972
loviji Avatar asked May 07 '12 07:05

loviji


2 Answers

You need Transactional Replication for your case. Here is why you would not need the other 4 cases:

Mirroring

  • This is generally used to increase the availability of a database server and provides for automatic failover in case of a disaster.
  • Typically even though you have more than a single copy of the database (recommended to be on different server instances), only one of them is active at a time, called the principle server.
  • Every operation on this server instance is mirrored on the others continuously (as soon as possible), so this doesn't fit your use case.

Log Shipping

  • In this case, apart from the production database servers, you have extra failover servers such that the backup of the production server's database, differential & transactional logs are automatically shipped (copied) to the failovers, and restored.
  • The replication here is relatively scheduled to be at a longer interval of time than the other mechanisms, typically ranging from an hour to a couple of hours.
  • This also provides for having the failver servers readies manually in case of a disaster at the production sites.
  • This also doesn't fit your use case.

Merge Replication

  • The key difference between this and the others is that the replicated database instances can communicate to the different client applications independent of the changes being made to each other.
  • For example a database server in North America being updated by clients across Americas & Europe and another one in Australia being updated by clients across the Asia-Pacific region, and then the changes being merged to one another.
  • Again, it doesn't fit your use case.

Snapshot Replication

  • The whole snapshot of the database is published to be replicated to the secondary database (different from just the log files being shipped for replication.)
  • Initially however, for each type of replication a snapshot is generated to initialized the subscribing database, i.e only once.

Why you should use Transactional Replication?

  • You can choose the objects (Tables, Views, etc) to be replicated continuously, so if there are only a subset of the tables which are used to reporting, it would save a lot of bandwidth. This is not possible in Mirroring and Log Shipping.
  • You can redirect traffic from your application to the reporting server for all the reads and reports (which you can also do in others too, btw).
  • You can have independent batch jobs generating some of the more used reports running on the reporting server, reducing the load on the main server if it has quite frequent Inserts, Updates or Deletes.
like image 100
vvnraman Avatar answered Sep 29 '22 08:09

vvnraman


Going through your list from top to bottom.

  1. Mirroring: If you mirror your data from your mainServer to your reportServer you will not be able to access your reportServer. Mirroring puts the mirrored database into a continuous restoring state. Mirroring is a High Availability solution. In your case the reportServer will only be available to query if you do a fail over. The mirrored server is never operational till fail over. This is not what you want as you cannot use the reportServer till it is operational.

  2. Log Shipping: Log shipping will allow you to apply transactional log backups on a scheduled event to the reportServer. If you backup the transaction log every 15 minutes and apply the data to the reportServer you will have a delay of 15+ minutes between your mainServer and Log server. Mirroring is actually real time log shipping. Depending on how you setup log shipping your client will have to disconnect while the database is busy restoring the log files. Thus during a long restore it might be impossible to use reporting. Log Shipping is also a High Availability feature and not really useful for reporting. See this link for a description of trying to access a database while it is trying to restore http://social.msdn.microsoft.com/forums/en-US/sqldisasterrecovery/thread/c6931747-9dcb-41f6-bdf4-ae0f4569fda7

  3. Replication : I am lumping all the replication together here. Replication especially transactional replication can help you scale out your reporting needs. It would generally be mush easier to implement and also you would be able to report on the data all of the time where in mirroring you cant report on the data in transaction log shipping you will have gaps. So in your case replication makes much more sense. Snapshot replication would be useful if your reports could be say a day old. You can make a snapshot every morning of the data you need from mainServer and publish this to the subscribers reportServer. However if the database is extremely large then Snapshot is going to be problematic to deal with on a daily basis. Merge replication is only usefull when you want to update the replicated data. In your case you want to have a read only copy of the data to report on so Merge replication is not going to help. Transactional Replication would allow you to send replications across the wire. In your case where you need frequently updated information in your reportServer this would be extremely useful. I would probably suggest this route for you.

Just remember that by implementing the replication/mirroring/log shipping you are creating more maintenance work. Replication CAN fail. So can mirroring and so can transaction log shipping. You will need to monitor these solutions to make sure they are running smoothly. So the question is do you really need to scale out your reports to another server or maybe spend time identifying why you cant report on the production server?

Hope that helps!

like image 30
Namphibian Avatar answered Sep 29 '22 09:09

Namphibian