Question

bidirectional synchronisation of databases

Asked by: andieje

Hi

This is my database set up:

I have a development machine on which i may change the database structure and add some data which is normally constant data (e.g. tables that hold data that is typically used to populate drop down lists and the link such as Title [mr, mrs, miss]). It also has some test data that i play around with. I have a production machine that uses the database structure and constant data from the development machine and gets its own 'real data' from people who use my application.

I would like to be able to synchronise the database structure and constant data from the development machine to the production machine but NOT copy across my 'play' data. Sometimes i might want to copy some 'real' data from the production machine to the development database.

What technology do i need to achieve this? I didn't think replication was suitable because i don't really have a master slave relationship. I have seen something called syncman i was going to look into.

Any advice appreciated

thanks

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-07-15 at 10:19:03ID24573020
Topic

MySQL Server

Participating Experts
2
Points
500
Comments
16

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. MR Microid Research error beep codes
    Does anyone have a list of MRbios error beep codes? Sometimes restarting W95 ends in a 1 short-[6-8]long- 1 short beep sequence and my pc locks-up. I have a Intel endeauvor m/b with vibra chip on board and MR bios.
  2. Synchronious "Shell"
    If I attempt to run a program from a command using Shell, it will run asynchroniously, ie the thread of execution will continue in the code whether the shelled command has completed or not. I know I read an article about using API calls to get an execution handle...blah blah...
  3. FAQ: DBWR_Slaves, LGWR_Slaves...
    Dear experts, I found out that in my alert log frequent checkpoints occured due to log switches (interval 0.5 sec). I have four redo log groups, 50MB each member, and I observed that at some point in time all me redo logs were in use and needed archiving, thus the checkpoint ...
  4. Master and Slave architecture
    What is going on behind the screen when my both hard drive and dvd-rom connected in the following arcitecture: Hard drive 1 - Primary Master Hard drive 2 - Primary slave DVD-ROM - Secondary Master Thanks
  5. java.io.NotSerializableException: Slave
    Hello All, I am trying to serialize an Object of a class I have created. The class is below (Slave). I want to serialize an object of this class, and send it using a "Platform" I have created, to another reciever "Platform" (both on my machine as an examp...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: TiggeritoPosted on 2009-07-16 at 03:45:35ID: 24868132

Do you have a clear definition of which tables go in which direction?

You may be able to set-up replication from devel->production for the subset of tables which will be mastered by devel.

Then, as needed, you could use backup and restore to copy table data from production to devel.

 

by: NovaDenizenPosted on 2009-07-16 at 09:14:27ID: 24870713

You need to settle on a "formal" configuration management process that meshes well with your workflow and provides satisfactory service for the production machine.  There's no magic "make everything sync up" command.

When you change the database structure of your development machine, you should be careful to save the commands that you ran.  Later you run the exact same scripts to update the production database.  You can't just willy-nilly modify your development database.  

 

by: andiejePosted on 2009-07-16 at 14:38:43ID: 24874155

Hi

Thank you for your answers but I am not any clearer about how I would achieve what I want to do. I am not a database person so i would appreciate more specific advice. If I have not provided enough information, please ask me for the details you need

NovaDenzien, why can't i modify the development database and then synchronise with the production database to propagate the changes to the production machine. Your use of the term 'willy nilly' makes this sound inherently bad but I would like to understand why

 

by: NovaDenizenPosted on 2009-07-16 at 15:06:27ID: 24874348

There is no magic propogation stick you can wave at the systems to make the changes happen.  You make changes X, Y, and Z to your development database, then later you have to make the exact same changes X, Y, and Z to the production database.  

I say "willy nilly" because sometimes developers get in an informal mindset where they make multiple small tweaks to their data models, then later forget the exact series of changes they made.  So when it comes time to update the production server they just make changes that approximate the state of the development server, which leads to inconsistencies.

The best way to do it is to record (through a SQL script or notes) the exact series of changes you make to the development database as you make them.  Then when it comes time to update the production server, follow the exact same procedure.

But I infer that you've already passed that point.  The "SHOW CREATE TABLE" statement is very useful for determining the precise differences between your dev and prod table structures.  The best way to run it is like "SHOW CREATE TABLE TableName\G", since the \G disables the ascii-art grid that the mysql client uses by default.  "SHOW CREATE TABLE" gives you the exact command you would need to run in order to exactly recreate the table, and it shows all the options for all the fields you have.

 

by: NovaDenizenPosted on 2009-07-16 at 15:11:34ID: 24874382

Also, the ALTER TABLE family of commands will come in very handy for changing the production table.  And of course, make a full backup of your production server before you touch a single thing on it.

http://dev.mysql.com/doc/refman/5.1/en/alter-table.html
ALTER TABLE mytable CHANGE COLUMN ...
ALTER TABLE mytable ADD COLUMN...

 

by: andiejePosted on 2009-07-20 at 16:39:14ID: 24900046

I was rather hoping there was a magic change propagation stick i could wave.

I understand the value of keeping track of my create and alter table commands and then applying these scripts to the development server. However, i was hoping there was something that could keep track of all my changes for me and then apply these changes in one deft swish if its wand to the other database.

The database are currently in synch because i do already do as you advise. With some many tools around i thought it could be automated.

 

by: NovaDenizenPosted on 2009-07-21 at 06:23:40ID: 24904221

Since the changes can be embodied in a .sql script, an automation tool is not really needed.  You just need to run the same script.

In general, automation tools are created when a similar process needs to be repeated many times by many people over many different systems.  With database applications, typically there are only two or a couple more databases that need to be managed, and it generally isn't worth the effort to create an automation tool that would be significantly more capable or reliable than a sysadmin manually running a script.

Also, database table configurations are rather finicky beasts and there is not a theoretically good way to automatically diff two databases to generate a patch.  So all an automatic database update tool could do would be to essentially run a pre-prepared script.

 

by: NovaDenizenPosted on 2009-07-21 at 06:29:08ID: 24904273

It _would_ be useful if a database permanently logged all the data definition changes that were made to it.  Then the changes could be automatically extracted and duplicated at other sites.  I haven't used a wide variety of databases, so it's possible this feature is out there and I've just never heard of it.

 

by: TiggeritoPosted on 2009-07-21 at 06:45:46ID: 24904427

I didn't realise this was more about syncing the structure of a database.

In our system we have a meta data file that defines the databases structure (XML). We also have a tool that creates SQL to convert a database so that it matches the meta data structure.

We find this very powerful when trying to keep many instances of a database in sync with the application.

 

by: andiejePosted on 2009-07-25 at 12:17:36ID: 24942829

Tiggerito, is that a bespoke tool or something you can buy?

Nova regarding thsi comment

It _would_ be useful if a database permanently logged all the data definition changes that were made to it.  Then the changes could be automatically extracted and duplicated at other sites.  I haven't used a wide variety of databases, so it's possible this feature is out there and I've just never heard of it.

That's exactly what i'm after :)

 

by: TiggeritoPosted on 2009-07-26 at 01:35:09ID: 24944761

Ours is in-house and proprietary. You would have to develop your own or find one...

The MySql Workbench can reverse and forward  engineer a database. It looks like it is possible to also synchronise databases with the schema models it makes.

You could reverse engineer from your official database then sync to all the other databases.

The bonus is you get a nice displayable model of your database.

http://dev.mysql.com/downloads/workbench/5.1.html

 

by: NovaDenizenPosted on 2009-07-27 at 07:26:45ID: 24951874

> That's exactly what i'm after :)

Unfortunately, that was just a pie-in-the-sky idea and not based on any actual database that I know about.  

This is the kind of thing that you have to do on your own, through a manual clerical process or an automatic tool that you create.

I believe it's theoretically impossible for an automatic diff-patch style solution to work.  Consider this scenario.

There are two servers, 'dev' and 'prod'.

initialization of dev:
    CREATE TABLE mytable ( `a`  INT );

Then you copy this table out to the production server.

Then on dev:
    ALTER TABLE table CHANGE COLUMN `a` `b` DOUBLE, ADD COLUMN `a` INT FIRST;

Now you want to automatically synchronize the dev and prod servers.  The synchronizer looks at the dev server and sees (`a` INT, `b` DOUBLE) and it looks at the prod server and sees (`a` INT).  So it makes the obvious change to the prod server:
    ALTER TABLE table ADD COLUMN `b` DOUBLE;

Which is, of course, the wrong thing.

 

by: NovaDenizenPosted on 2009-07-27 at 07:36:29ID: 24951991

I forgot the step after the copy where the dev and prod servers are populated with data which diverge, but I hope it's still clear.

 

by: TiggeritoPosted on 2009-07-27 at 08:26:27ID: 24952564

The step we used separates definition/schema from the actual  data structure so it get around the issues related to diff'ing SQL.

Our system queries the current database structure and create sql that will convert it to conform with the current schemas.

Another possible solution is SQLyog. It used to have a diff tool, however I can't see it on its latest feature list!

http://www.webyog.com/en/sqlyog_feature_list.php

 

by: andiejePosted on 2009-08-06 at 15:30:42ID: 25038724

Thanks for both your help

 

by: andiejePosted on 2009-08-06 at 15:31:49ID: 31603849

thanks

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...