How to copy database structures
Last modified: July 4, 2024
Schema Compare supports copying the structure and designing of an existing database and creating a completely new one that looks the same. This process involves comparing the schemas of two databases, identifying the differences in their structures, and applying these changes to the target database.
To copy the structure of a database:
1. Create an empty database by following the steps:
- On the toolbar, click New Schema Comparison to open the New Schema Comparison wizard.
- On the Source and Target page of the wizard, select Database as a source type, the server connection on which you want to create the database and click
Create New Database in the Database field.
- In the Database Editor that opens, specify the database name, charset, and collation. To save the changes, click Apply changes.
- Click the cross sign in the upper-right corner of the Database Editor to close it.
Note
Alternatively, you can create a database in dbForge Studio for MySQL.
2. On the Source and Target page of the New Schema Comparison wizard, select a database or a scripts folder as a Source and the database you’ve created as a Target.
3. Optional: On the Options page, configure the comparison options.
4. To run the comparison, click Compare. The Schema Comparison progress window opens, showing the stages of the comparison process.
5. In the comparison results grid that opens, all the database objects are selected by default. To exclude the objects from synchronization, clear the checkboxes next to the corresponding objects.
6. To proceed with synchronization, click Synchronize objects to the target database to open the Schema Synchronization Wizard.
7. On the Output page of the wizard, select the output option to manage the synchronization script:
- Open the synchronization script in the internal editor (default option) to open the script for database synchronization in the internal editor of the Schema Compare tool.
- Save the script to a file to save the script locally on your PC. To open the script in the internal editor after saving, select the checkbox next to this option.
- Execute the script directly against the target database to execute the script immediately without allowing you to review it.
8. Optional: On the Options page, configure the synchronization options.
9. Optional: On the Additional Scripts page, type or select the script to be executed before and after the schema synchronization.
10. Optional: On the Summary page, review the synchronization actions and warnings.
To change the settings, click Back.
11. Click Synchronize to run schema synchronization.
If you select the Open the synchronization script in the internal editor option, the synchronization script opens in the editor. You can review it and click Execute on the toolbar.
Return to the comparison results grid and click Refresh. The Source database structure has been copied, so there are no changes to synchronize.