How do I create a realtime copy of my SQL Server 2005 database?
-
25-09-2019 - |
Question
I have a web app that is used on multiple continents. The underlying transaction DB is locking up when large reports are run. I want to:
- make a realtime of the SQL Server 2005 database to a reports DB
- direct all reporting to the reports DB
In theory this will prevent transaction locking for inserts and updates. It is OK if the reports DB gets locked temporarily as long as the transactions continue. The reports DB can receive the new transactions when it is under a lighter load. What is the best way to maintain a near realtime copy of the transaction DB? Should I use replication, mirroring or a combination of the two? What general guidelines I should follow?
Thanks!
Solution
Use Sql Server replication for implementing this kind of architecture. E.g. replicate data from your main db server to the reporting server. It's not quite real time (few systems are) but can be very close.
There are several flavors with Sql Server replication and you'll probably want server-to-server. Also see this article about data warehousing and reporting. It describes the exact scenario that you're up against and your goals:
By design, transactional replication addresses the principal requirements for this scenario:
- Transactional consistency
- Low latency
- High Throughput
- Minimal overhead
OTHER TIPS
Mirroring = whole DB, replication is a subset usually based on what you "publish"
- Mirroring is easier to set up but you then need snapshots to allow reporting.
- Books on line example is based on replication
In this case, I'd use replication if you need near real-time. I'd consider mirroring if reporting could lag a few minutes or reports should be "static" for a period of time.