A Step-by-Step Guide for SQL Examiner, the Database Comparison and Synchronization tool
Comparing and synchronizing two databases is easier than you think. You’ll learn how in this short, step-by-step tutorial.
|
|
To start a new comparison, simply click the “New” button, located on the toolbar, or select File » New in the File menu.
|
|
|
The window that appears has fields that let you select database server, authentication method (SQL Server or Windows authentication) and databases to be compared. The process of comparison is started after you press “Compare”. To specify what database objects you need to compare, and set additional comparison options, check “Configure advanced settings”. Click “Next” to continue.
|
|
|
On the “Filter” tab, you can specify what objects should be compared. If you need to compare all database objects, select “All objects”. If you need to compare only some of the objects, you can select either “Selected objects only” or “All but selected objects” in the drop down list, and manually check the objects you want to include or exclude from the comparison. Besides, you can specify the list of objects that should be included or excluded from the comparison in a template, and use this template.
|
|
|
On the “Options” tab, you can specify the necessary comparison and synchronization options. If you later need to change these settings, you can do it on the “Projects Settings” tab in the “Tools” menu.
|
|
|
While the program is comparing the selected databases, the “Progress bar” window indicates which operations are complete, which are in progress and which are pending.
|
|
|
After comparison is complete, you can check the results. The database objects are displayed in the object tree; the differences between the selected objects are displayed in the right panel.
|
|
|
The “SQL1” and “SQL2” tabs allow you to review the script that will synchronize these differences. The “SQL1” tab shows the script that will make the selected object in the first database the same as in the second.
|
|
|
Since there may be many objects displayed, you can choose to examine all the objects or only those that differ.
|
|
|
In the object tree, select the objects you want to synchronize. If you want to synchronize only certain differences, switch to “Partial Synchronization”. If you want to select all the database objects, click “Select All” (located above the database object tree). Likewise, you can select only certain types of objects – all tables, for example – by simply checking the box near the appropriate node in the database object tree. Then launch the synchronization wizard (Tools » Synchronize)
|
|
|
You’ll be asked to select the synchronization direction. You’ll also be prompted to make a backup copy of the database that will be changed. We recommend that you do this because when you type in the path, it will be the path to the PC where the SQL server is located (and where the altered database is stored), not to your local PC. Click “Next” to continue.
|
|
|
During this part of the synchronization process, you’ll be warned about potential problems that could lead to a synchronization failure. For example, a warning will be displayed if you try to add a NOT NULL column to a table containing the data. You can stop to solve the problems you were warned about, which will provide you with additional control over the synchronization process, resulting in a better script. But if you think there's no need for additional settings, you can simply go on to the next step without resolving the potential problems.
|
|
|
This step generates the synchronization script. If you click the “Summary” tab, you will see a list of actions being performed; the “Script” tab shows the script that is synchronizing the databases. Object dependencies are honored while the script is being generated. The script can be opened in “Query Analyzer” or saved (use the “Send to QA” or “Save” buttons). Click “Next” to continue.
|
|
|
On this step, you can specify what actions should be performed on the synchronization script: execute the script, save it or send it to an external application. If you want to review the results of the synchronization, check the “Compare databases after synchronization” option. Then click “Execute” to perform the specified actions. The databases are now synchronized!
|