2

I can't pick the right solution for my below requirement. Can you people please advise?

We have two SQL Server 2012 database servers:

  1. First one is in Texas (USA). Our client will use this for UAT.
  2. Second one is in Chennai (India). This one we will use for development/local testing.

While testing our application, the client will find issues/bugs in UAT environment, so we need to replicate to our development environment for further analysis, and to develop fixes for the bugs.

We are planning to sync two databases present in two different places. I am looking to synchronize the database in single direction. It should support write operations.

I have found a few potential solutions:

  1. Transaction Log Shipping

    In Transaction Log Shipping the secondary database is always in read only/restoring mode, so we can not perform any write operations. I need to do write operations to provide fixes for the issues/bugs. So I think log shipping will not be useful.

  2. Database Mirroring and Always On High Availability

    As a junior DBA, I don't have much knowledge of these. Please advise if these would fit for me.

  3. Scheduling a daily job

    Taking a backup of the UAT server and restoring it to our local development server, copying the database backup via FTP.

Can you please advise which solution will be the best fit for this?

Edit:- I would like to move data changes happening in Database 1(Server 1) to Database 2(Server 2). After moving changes to database 2(Server 2) it should be writable mode. And i don't want to move changes happening in database 2(Server 2) to database 1 (Server 1). So it's a single direction sync.

Below image will gives better understanding. enter image description here

2

For simplicity if this was for a limited time frame, i would go with backup and restores.

Unless you are required to respond within minutes you could probably get by with daily backups. You could even set up a job to take a backup and FTP it on demand, after they have reported a defect.

I wouldn't even bother restoring daily unless the issue was specific to newly created data. In my experience UAT is more about functionality. So you test with existing data and create new data. Having a db a few days behind theirs means you should be able repeat the test and reproduce the defect.

This approach would get slower, more difficult and less feasible the bigger the db is.

If you will be providing ongoing support, the db is huge, and you have SLA saying you have to respond within minutes, replication/synchronization of some sort might be worth the effort to set up.

The best solution for you may be dictated by client security or technical policies. Work with them to ensure what you are proposing is acceptable. If not keep in mind there are lots of variations on this theme. But it all boils down to: 1. you need something to take a back up, and 2. you need something to FTP the files either on a schedule or on demand.

If I was doing this personally I would begin with Ola Hallengren's backup scripts. After installing that I'd create a SQL Agent job which invokes the backup.

I would then edit the agent job to add a step to FTP the files. I just had a quick search and found this example of how to use SSIS to FTP a file and I found this example of an FTP script for SQL Server.

My recommendation is that you set this job up to run on a schedule, and only run it on demand if truly required. If you don't have remote access and permission to execute tasks, you can request someone on the client site execute the task for you.

  • 1
    Hi @peter, Thanks for your answer. Can you help me how to write script for scheduling job to take backup and FTP it on demand? Or Suggest any blogs where i can get scripts for doing this activity. – Tharunkumar Reddy Feb 3 '17 at 7:04
3

User acceptance testing (UAT) usually involves clicking around in an application, which usually means making changes and testing them.

This is especially true if you think you're going to "replicate those issues/bugs to our development environment" - it sounds like you're thinking about synchronizing in both directions.

That requires a writable database, and unfortunately, that rules out transaction log shipping, database mirroring, and Always On Availability Groups. All of those scenarios are designed for read-only secondary databases.

If both sides are going to be changing the data, then in theory, you could use SQL Server's replication techniques (merge, peer-to-peer, bidirectional transactional replication) to push data in both directions. In practice, your developers will be making table schema changes to the development database, and that's likely going to break replication.

  • Thanks for your suggestion. Actually i am looking for synchronizing database in single direction,and it should support write operation. Since we are delivering the fixes through code which directly compiled in UAT itself. Please advice. – Tharunkumar Reddy Jan 18 '17 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.