Additional /datacompare Argumemts

This topic gives detailed description of command line switches and examples of their usage.

You can select the required options while setting the comparison in the Data Comparison wizard and generate a file with command line arguments by clicking Save settings to a file.

Arguments

To get more information on switches related to data comparison in the command line interface, you can type:

C:\Program Files\Devart\dbForge Data Compare for SQL Server>datacompare.com /datacompare /?

Below all switches of this option are described, together with usage examples.

Action Parameter
Load command line settings from comparison *.dcomp project file /compfile:< path >
Save the comparison results to a log file, specify the file location and name. /log:”D:\Log.log”
Exclude objects from comparison if they match the given expression by using the /meobjmask argument and specifying the needed expression. To turn the option off, specify No, N, Off, False, F. /meobjmask:<expression/N>
Exclude columns from the comparison if they match the given expression. To turn off the option, specify: No, N, Off, False, F. /mimask:<expression/N>
Include objects to comparison if they match the given expression by using the /miobjmask argument and specifying the needed mask expression. To turn the option off, specify No, N, Off, False, F. /miobjmask:<expression/N>
Specify a path to the report file. Note, that in this case there is no need to specify the file format separately. /report:”D:\report_file.html”
To generate and save a comparison report, specify the report format (HTML, XLS, CSV) along with the report location and name. /reportformat:<HTML/XLS/CSV>

Usage Examples

To practice comparison and synchronization through the command line, try to generate a synchronization script for a database backup and a live database. To do this, you should first change the default path in the command line by typing cd (for example, `C:\Program Files\Devart\dbForge Data Compare for SQL Server\datacompare.com`) and pressing Enter. After the default directory has changed, type the following arguments into the Command Prompt:

~~~code
"C:\Program Files\Devart\dbForge Data Compare for SQL Server\datacompare.com" /datacompare /source backup:"D:\backup_file.bak" /target server:mssql2014 database:db_name user:user_name password:"password" /CheckIdentical:Yes /sync:"D:\sync_script.sql"( /report:"D:\report_file.html")
~~~
  1. Compare data using settings from a file saved earlier:

    /datacompare /compfile:"D:\workDir\DC1vsDC2.dcomp"
    
  2. Compare and synchronize data using connection string. Log will be written to the specified file: /datacompare /source connection:

    "Connect Timeout=120;Data Source=SqlServer1;Initial Catalog=db1;Integrated Security=False;User ID=sa;Password=sa;Pooling=False" /target connection:"Connect Timeout=120;Data Source=SqlServer2;Initial Catalog=db2;Integrated Security=False;User ID=sa;Password=sa;Pooling=False" /sync /log:"D:\sync.log"
    
  3. Compare data of the specified databases and save the synchronization script to the:

    D:\compare_result.sql file: /datacompare /source server:SqlServer user:sa password:sa database:db1 /target server:SqlServer user:sa password:sa database:db2 /sync:"D:\compare_result.sql"
    
  4. Compare and synchronize data using settings from the file, do not generate comments in the synchronization script, turn off dml triggers during synchronization; generate a report to the specified file in the HTML format:

    /datacompare /compfile:"DC1vsDC2.dcomp" /nocomments:yes /nodml:yes /report:"report.txt" /reportformat:HTML /sync
    
  5. Compare and synchronize data using settings from a file. Synchronize Lob columns using files:

    /datacompare /compfile:"D:\workDir\DC1vsDC2.dcomp" /fspath:"\\SqlHost\Temp" /sync
    
  6. Compare data and generate data report using settings from a file. Comparison and data writing settings of the different objects will be included into the report.

    /datacompare /compfile:"DC1vsDC2.dcomp" /report:"report.html" /incdata:Yes /incs (settings:Yes)