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.
Note
To run the Command Line in Windows 10:
From the Desktop Mode
- Move the mouse cursor to the exact lower left corner until the desktop shortcuts menu appears.
- Right-click to see the shortcut menu and than click Run.
From the Charms Bar
- Move your mouse to the upper right corner until the Charms Bar appears.
- Select Apps from the list and type ‘run’ in the search box.
- Click Run from the search results.
Use Windows + R Shortcut Keys
- In desktop mode, press the Windows + R keys, to show the Run command line.
- In the window that opens, type cmd and press Enter.
datacompare [/argfile:filepath] [/operation_switch] [/switch1[:value | [parameter1:value parameter2:value ..]] /switch2 ..]
The first argument for datacompare is usually an operation switch that corresponds to the operation that you want to perform with the application.
Switch | Usage |
---|---|
/argfile |
Specifies the path to the command-line arguments file. Options specified in the command line have higher priority than the options that were given in the argfile. |
/activate |
Activates a product using the activation key. |
/deactivate |
Deactivates a product. |
/backup |
Backs up a database. |
/datacompare |
Launches data comparison. |
/execute |
Executes a script. |
/restore |
Restores a database. |
/scriptsfolder |
Creates a scripts folder of the target schema. |
/quiet (/q ) |
Hides the console window in console mode. It should be used after the main operation switch. |
Activate a product using the activation key.
Parameter | Description |
---|---|
exitcodes |
Lists possible exit codes that can be returned by the command-line process. |
key |
Specifies a product activation key. |
Deactivate a product
Parameter | Description |
---|---|
exitcodes |
Lists possible exit codes that can be returned by the command-line process. |
Backup a database.
Parameter | Description |
---|---|
connection |
Specifies a connection string. |
database |
Defines a database to backup. |
errormode |
Specifies the application behavior when there is an error. |
exitcodes |
Lists possible exit codes that can be returned by the command-line process. |
outputfile |
Specifies a file name for storing the backup. The parameter overrides a file name specified in a backup project. |
password |
Defines a server password. The parameter overrides a password specified in the connection string. |
projectfile |
Specifies a backup project to use. Switches can override some project options. |
treatwarningaserror |
Defines the application behavior when there is a warning. |
Launch data comparison.
Parameter | Description |
---|---|
/source |
Connects to a live database by specified parameters with the following options: host:\<name> database:\<db> [port:\<port>] user:\<yourusername> [password:\<yourpassword>] [charset:\<charset>] . Also, it allows specifying the full connection string with additional parameters: connection:<connection_string> . To specify the file path to a SQL Server backup file (.bak) or backup files taken from the differential backup: backup:<filepath> [backup:<filepath> ...] |
/target |
Connects to a live database by specified parameters with the following options: host:\<name> database:\<db> [port:\<port>] user:\<yourusername> [password:\<yourpassword>] [charset:\<charset>] . And it allows specifying the full connection string with additional parameters: connection:<connection_string> . To specify the file path to a SQL Server backup file (.bak) or backup files taken from the differential backup: backup:<filepath> [backup:<filepath> ...] |
/compfile |
Loads command-line settings from the comparison project file - *.dcomp. |
/meobjmask |
Excludes objects from comparison if they match a given expression. To exclude objects from the comparison, specify a mask expression. To turn the option off, specify No , N , Off , False , or F . |
/micolmask |
Excludes columns from the comparison if they match a given expression. To exclude columns from the comparison, specify a mask expression. To turn the option off, specify No , N , Off , False , or F . |
/miobjmask |
Includes objects to comparison if they match a given expression. To include objects to the comparison, specify a mask expression. To turn the option off, specify No , N , Off , False , or F . |
/options |
Specifies some comparison or synchronization options directly in the command-line interface. See the list of available options and learn how to use them in Options Used in Command Line for /datacompare. To turn the option off, specify No , N , Off , False , or F . |
/sync |
Launches database synchronization. If an output file path is specified, the program will generate only a synchronization script. |
/report |
Generates a data comparison report file. If the output file name has a .html, .xls or .xml extension, it is not necessary to specify the file format - it will be chosen depending on the extension. For more information, refer to Options used in the command line. |
/reportformat |
Generates the comparison report in the following foramts: HTML : A simple HTML file XLS : A simple Microsoft Excel file XML : A simple XML file XMLFOREXCEL : A simple XML file for XML Spreadsheet 2003 When a format is not explicitly specified, it is automatically determined based on the file extension of the report |
/includeobjects |
/includeobjects:<All|Filtered|Diff|SelectForSync Specify objects for the report: * 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. |
/log |
Writes a comparison log to the specified file. |
/exitcodes |
Lists possible exit codes that can be returned by the command-line process. |
Execute a script.
Parameter | Description |
---|---|
connection |
Specifies a connection string: /connection:/<connection_string> . |
password |
Defines a server password or override the password specified in the connection string: /password:/<yourpassword> . |
database |
Specifies a database to script or override the database specified in a template or in a connection string. |
encoding |
Sets the encoding which should be applied to open and execute the script: /encoding:<codepage/|encoding name> . |
inputfile |
Defines an SQL or ZIP file with a script to execute. |
zippassword |
Enters a password for a protected archive that contains the script: /zippassword:/<zip password> . |
exitcodes |
Lists possible exit codes that can be returned by the command-line process. |
Restore a database.
Parameter | Description |
---|---|
connection |
Specifies a connection string. |
createdatabase |
Creates a database specified in the /database switch if it does not exist. |
database |
Defines a database to restore. The parameter overrides a database specified in the connection string. Databases specified in the script will be ignored. |
encoding |
Specifies the encoding which should be applied to open and execute the script. |
exitcodes |
Lists possible exit codes that can be returned by the command-line process. |
inputfile |
Specifies an SQL or ZIP file with a script to execute. |
password |
Enters a server password. The parameter overrides a password specified in the connection string. |
zippassword |
Defines a password for a protected archive that contains the script. |
Create a scripts folder of the target schema.
Parameter | Description |
---|---|
connection |
Specifies a connection string. |
password |
Specifies a server password. The parameter overrides a password specified in the connection string. |
database |
Defines a database to create a scripts folder for. |
exitcodes |
Lists possible exit codes that can be returned by the command-line process. |
includedata |
Defines whether to include data. |
path |
Defines a scripts folder path. |
1. Compare data using settings from the file saved earlier:
C:\Program Files\Devart\dbForge Compare Bundle for MySQL Standard\dbForge Data Compare for MySQL Server>datacompare.com /datacompare / compfile:"D:\workDir\sakilavssakila1.dcomp"
2. Compare schemas using settings from the file and write log to a specified file:
C:\Program Files\Devart\dbForge Compare Bundle for MySQL Standard\dbForge Data Compare for MySQL Server>datacompare.com /datacompare / compfile:"sakilavssakila1.dcomp" /log:"D:\sync/log"
3. Compare data using settings from the file, generate a report to the specified file in the HTML format:
C:\Program Files\Devart\dbForge Compare Bundle for MySQL Standard\dbForge Data Compare for MySQL Server>datacompare.com /datacompare / compfile:"sakilavssakila1" /report:"D:\report.txt" /reportformat:HTML
4. Compare schemas using using settings from the file saved before, and save a synchronization script:
C:\Program Files\Devart\dbForge Compare Bundle for MySQL Standard\dbForge Data Compare for MySQL Server>datacompare.com /datacompare / compfile:"sakilavssakila1" /sync:"D:\compare_result.sql"
5. To compare data of the specified databases and save the synchronization script to the file, use: /sync:"D:\compare_result.sql"
C:\Program Files\Devart\dbForge Compare Bundle for MySQL Standard\dbForge Data Compare for MySQL Server>datacompare.com /datacompare /source connection:"Host=ServerB;Port=3306;Database=sakila;User Id=yourusername;Password=yourpassword;Character Set=utf8" /target connection:"Host=ServerA;Port=3306;Database=sakila1;User Id=yourusername;Password=yourpassword;Character Set=utf8" /sync:"D:\compare_result.sql"
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.
C:\Program Files\Devart\dbForge Compare Bundle for MySQL Standard\dbForge Data Compare for MySQL Server>datacompare.com /datacompare /compfile:"sakilavssakila1.dcomp" /report:"report.html" /incdata:Yes /incsettings:Yes
Note
To build the command-line syntax, it’s better to use the Command-line Wizard.