Comparing and Synchronizing Data

You can automate data comparison and synchronization using the command line.

Running Comparisons from the Command Line

  1. Click Start.

  2. Type cmd in the Search programs and files text box and press ENTER.

  3. Type a path to the datacompare.com extension located in the dbForge Data Compare for MySQL installation folder on your PC, and press the SPACE key.

    C:\Program Files\Devart\dbForge Data Compare for MySQL\datacompare.com
    
  4. Specify command line arguments (connection strings and actions you want to run). For example, specify the type of the operation.

    C:\Program Files\Devart\dbForge Data Compare for MySQL>datacompare.com /datacompare /?
    
  5. Specify the objects that will be compared and synchronized.

    C:\Program Files\Devart\dbForge Data Compare for MySQL>datacompare.com /datacompare /compfile:"D:\mycompdoc.dcomp"
    
  6. Synchronize data directly into the database and generate a synchronization script file.

    C:\Program Files\Devart\dbForge Data Compare for MySQL>datacompare.com /datacompare /compfile:"D:\mycompdoc.dcomp" /sync:"D:\mysync.sql" 
    

    To synchronize data automatically, use /sync without file name specification:

    C:\Program Files\Devart\dbForge Data Compare for MySQL>datacompare.com /datacompare /compfile:"D:\mycompdoc.dcomp" /sync
    
  7. Generate a comparison and synchronization protocol into a file.

    C:\Program Files\Devart\dbForge Data Compare for MySQL>datacompare.com /datacompare /compfile:"D:\mycompdoc.dcomp" /sync:"D:\mysync.sql" /log:"D:\mylog.log" 
    
  8. Compose a comparison report.

    C:\Program Files\Devart\dbForge Data Compare for MySQL>datacompare.com /datacompare /compfile:"D:\mycompdoc.dcomp" /sync:"D:\mysync.sql" /log:"D:\mylog.log" /report:"D:\myreport.html" 
    
  9. Specify the report format. HTML and EXCEL formats are available.

    C:\Program Files\Devart\dbForge Data Compare for MySQL>datacompare.com /datacompare /compfile:"D:\mycompdoc.dcomp" /sync:"D:\mysync.sql" /log:"D:\mylog.log" /report:"D:\myreport.html" /reportformat:HTML
    
  10. Press ENTER to run the process.

    Tip: To execute the synchronization script, use the /execute switch:

    C:\Program Files\Devart\dbForge Data Compare for MySQL>datacompare.com /execute /connection:"User Id=root;Host=db;Port=3320;Database=test;Character Set=utf8" /inputfile:"D:\mysync.sql"
    

Generate File With Command Line Arguments

To generate a file with command line arguments, open the Data Comparison wizard.

To access the Data Comparison wizard click New Data Comparison on the start page. Alternatively, on the File menu, click New Data Comparison.

Select Source and Target for comparison. Go through other wizard pages to tune the data comparison.

On the Options tab, click Save settings to a command line arguments file and specify the file name and location to save the file. The selected Source and Target connection strings along with comparison options will be saved as command line arguments in the file. You can edit the values of comparison options in the file.

Note that the generated file does not contain password information for security purposes. You should edit the file and enter the passwords manually.

You can see available additional arguments and learn how to use them in the Additional /datacompare Arguments topic.

The command line string with /argfile parameter will be written as follows:

C:\Program Files\Devart\dbForge Data Compare for MySQL>datacompare.com /argfile:file_name.txt