Question

I am just looking for some advice here as I am quite new to this. I have a client who requires a local copy of a SQL database and the same database running on a remote server. the remote database is only kept as a backup and needs to be updated usign the information from the local database nightly.

What would be the best solution for this. Should I write a C# application to copy the database accross to the live server nightly or does SQL server has something that we can use? If it is C# application do I need to use bulkcopy? would that also copy over the rows that has been changed or updated as well?

Any help would be greatly appriciated.

Was it helpful?

Solution

Use SQL Server Agent and create a job with 3 steps:

  1. Backup local database
  2. Copy .bak file to remote server
  3. Restore .bak to remote server

OTHER TIPS

does it need to be an exact copy? Why not blow away the tables each night on the backup and bulkcopy them over on a schedule?

You can also use tools like Redgate SQL Comparison SDK to schedule schema and data changes and be done with

Here are couple options you can try:

  • SQL Server Agent job or a simple bat or powershell script that will backup, copy and restore database at the same time every day
  • Third party tools such as Red Gates comparison SDK or ApexSQL Diff API

How big are these updates? If this is something that doesn’t involve too much updates you might be able to do that with linked server and a bit more sophisticated queries.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top