Question

How can I automate the SqlCompare which compares and synchronizes the databases on different servers to run nightly?. Can you provide me a link or brief steps on how to handle this?

No correct solution

OTHER TIPS

you can run this from a .bat or .cmd file as a scheduled task

inside the task just do something as follows:

cd "C:\Program Files\Red Gate\SQL Compare 7"

SQLCompare /db1:<dbname>
           /db2:<dbname> 
           /synchronize

this will then perform the sync. Alternatively you could do this via CI system and call the same type of command via msbuild

That may not be the right tool for the job SQLCompare is only concerned with schema, which can have some unfortunate effects on your data. Consider if you change columns, RedGate will either

  • work (when growing a size or something),
  • drop the column (when changing a data type) or
  • fail (what it should normally do).

It sounds like what you want is a nightly replication scheme, which will preserve the data as well as the schema.

I just solved this problem myself. In my case, I have people that monkey around in the database unbeknownst to me and break the app. Unfortunately I cannot get them to stop playing in the database so I wrote a simple program in C#. It executes the SQL Compare command and looks in the response string for "The selected objects are identical". If it doesn't find this, it emails me to notify me that something is up. I used Windows Scheduler to schedule it for the morning and afternoon.

It's not the most elegant solution but it works.

If you'd like to use a CI server to achieve this, you can now do this using the newly released CI command line and build script sample files available on http://www.red-gate.com/ci

For TeamCity users, there's a custom plugin.

These are free downloads, although bear in mind that you'll need the appropriate Red Gate license to use this beyond the trial period.

You might try automation software to kick it off nightly using either the scheduler or a trigger. Automation Anywhere is good for this. Let me know if you want more info or just google it. -Tom

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