Additional /datacompare arguments

This topic provides a detailed description of the 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.

Command-line arguments

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

C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com /datacompare /?

Note

The path to the executable file will differ depending on how you have installed the Studio - as a standalone tool or as part of the dbForge Edge bundle. Make sure that you have specified a correct path. If you have installed the Studio as part of dbForge Edge, change the path accordingly:

"C:\Program Files\Devart\dbForge Edge\dbForge Studio for SQL Server>dbforgesql.com"

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

Action Parameter
Loads command-line settings from comparison *.dcomp project file /compfile:<path>
Groups objects in comparison report:
* none - no grouping is applied
* status - objects are grouped by status
* object - objects are grouped by object type.</ul>
/groupby:<none>
Saves the comparison results to a log file. Specify the file location and name. /log:"D:\Log.log"
Excludes 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>
Excludes columns from the comparison if they match the given expression. To turn off the option, specify: No, N, Off, False, F. /mimask:<expression/N>
Includes objects in the 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>
Specifies 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"
Generates and saves a comparison report, specify the report format (HTML, XLS, CSV) along with the report location and name. /reportformat:<HTML|XLS|CSV>
Sets objects for the report, enter one of the following options:
* All - all objects;
* Filtered - filtered objects;
* Diff - objects with differences;
* SelectForSync - objects selected for synchronization.
The option refers specifically to the report generation in the HTML/XLS/XML formats and does not work separately from the /report:<filepath> key.
/includeobjects:<All|Filtered|Diff|SelectForSync>
Generates and saves a synchronization script, specify the file location and name. If an output file path is specified, the program will generate only a synchronization script. /sync:"D:\sync_script.sql"

Usage examples

To practice data comparison and synchronization from the command line, 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 <required path> (for example, C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com) and pressing Enter. After the default directory has changed, type the following arguments into the Command Prompt:

"C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /datacompare /source backup:"D:\backup_file.bak" /target server:mssql2014 database:db_name user:yourusername password:"yourpassword" /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 a 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=yourusername;Password=yourpassword;Pooling=False" /target connection:"Connect Timeout=120;Data Source=SqlServer2;Initial Catalog=db2;Integrated Security=False;User ID=yourusername;Password=yourpassword;Pooling=False" /sync /log:"D:\sync.log"

3. Compare data of the specified databases and save the synchronization script to the:

/datacompare /source connection:"Data Source=demo\SQLEXPRESS02;Initial Catalog=DC1;Integrated Security=True" /target connection:"Data Source=demo\SQLEXPRESS02;Initial Catalog=DC2;Integrated Security=True" /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.html" /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 for different objects will be included into the report.

/datacompare /compfile:"D:\Compare\DC1vsDC2.dcomp" /report:"D:\Reports\CompReportDC1vsDC2.html" /reportformat:html /includeobjects:All /incdata:Yes /incs:Yes

Note

To build the command-line syntax, it’s better to use the Command-line Wizard.