Command-line mode on Linux
Last modified: April 10, 2024
This topic describes the CLI-powered access to the functionality of dbForge Schema Compare installed into a CrossOver bottle. For more information on the command-line functionality of dbForge Schema Compare, refer to the corresponding topics of the documentation.
As an example, let’s see how to compare database schemas from the command line. To do that, run the following command:
"/opt/cxoffice/bin/wine" --bottle "dbForge_MySQL" --check --wait-children --start "C:\Program Files\Devart\dbForge Compare Bundle for MySQL Standard\dbForge Schema Compare for MySQL\schemacompare.com" /schemacompare /source connection:"User Id=[yourusername];Host=[host];Password=[yourpassword];Database=[database];Character Set=utf8" /target connection: "User Id=[yourusername];Host=[host];Password=[yourpassword];Database=[database];Character Set=utf8" /sync
Where:
- “/opt/cxoffice/bin/wine” is the command that initiates CrossOver.
- –bottle “dbForge_MySQL” is the parameter that specifies the name of the bottle that contains dbForge Schema Compare.
- –check –wait-children –start are options that configure the launch of the application.
- “C:\Program Files\Devart\dbForge Compare Bundle for MySQL Standard\dbForge Schema Compare for MySQL\schemacompare.com” /schemacompare /source connection:”User Id=[yourusername];Host=[host];Password=[yourpassword];Database=[database];Character Set=utf8” /target connection: “User Id=[yourusername];Host=[host];Password=[yourpassword];Database=[database];Character Set=utf8” is the command that runs a schema comparison with the specified options.
- /sync changes the Target schema according to the Source schema.
Worked example
Let us look at a worked example command to compare the schemas of two MySQL databases that reside on the dbfmylast server.
"/opt/cxoffice/bin/wine" --bottle "dbForge_MySQL" --check --wait-children --start "C:\Program Files\Devart\dbForge Compare Bundle for MySQL Standard\dbForge Schema Compare for MySQL\schemacompare.com" /schemacompare /source connection:"User Id=yourusername;Host=dbfmylast;Password=yourpassword;Database=db_staging;Character Set=utf8" /target connection:"User Id=yourusername;Host=dbfmylast;Password=yourpassword;Database=db_production;Character Set=utf8" /sync
The schema comparison and synchronization process begins and finishes successfully.
Run a batch file
You can run not only individual commands, but also generated batch files (*.bat/*.cmd files), which are to be created as usual Windows batch files.
Let’s look at an example of code for a batch file.
"/opt/cxoffice/bin/wine" --bottle "dbForge_MySQL" --check --wait-children --start "C:\users\crossover\My Documents\schemacompare.bat"
Where:
- /opt/cxoffice/bin/wine is the command that initiates CrossOver.
- –bottle “dbForge_MySQL” is the parameter that specifies the name of the bottle that contains dbForge Schema Compare.
- –check –wait-children –start are options that configure the launch of the application.
- “C:\users\crossover\My Documents\schemacompare.bat” is the parameter that specifies the path to the batch file.
Note
You can automate the launch of dbForge Schema Compare from the command line using the standard Linux scheduler.