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.
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 |
---|---|
Backup the Target database before the synchronization, specify the file location and name. If the location and name are not specified, the file will be stored in the default server’s backup directory. | code/backup:"D:\backup_file.bak" |
Load command line settings from comparison *.dcomp project file | code/compfile:<path> |
Group objects in comparison report: * none - no grouping is applied * status - objects are grouped by status * object - object are grouped by object type.</ul> |
code/groupby:<none/status/object> |
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> |
Generate and save 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" |
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
"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")
Compare data using settings from a file saved earlier:
/datacompare /compfile:"D:\workDir\DC1vsDC2.dcomp"
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=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"
Compare data of the specified databases and save the synchronization script to the:
D:\compare_result.sql file: /datacompare /source server:SqlServer user:yourusername password:yourpassword database:db1 /target server:SqlServer user:yourusername password:yourpassword database:db2 /sync:"D:\compare_result.sql"
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
Compare and synchronize data using settings from a file. Synchronize Lob columns using files:
/datacompare /compfile:"D:\workDir\DC1vsDC2.dcomp" /fspath:"\\SqlHost\Temp" /sync
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)
Download dbForge Studio for SQL Server and try it absolutely free for 30 days!