When you create a new schema comparison project and select your data sources, Schema Compare automatically maps objects with the same name and schema for you.
In case you need to compare objects having the same name, but belonging to different schemas, you can map the schemas as the circumstances require. For example, if you want to compare objects in a test database that are owned by HR with objects in a production database that are owned by Staff, you can map HR to Staff.
You can edit mappings on the Schema Mapping page of the New Schema Comparison wizard.
You can map multiple source schemas to one target schema on the Schema Mapping tab of the New Schema Comparison wizard. To do that, use the Target schema drop-down list to select the same target schema next to each source schema that you want to map.
The mapping results will be similar to the following.
You can similarly map one source schema to multiple target schemas on the Schema Mapping tab of the New Schema Comparison wizard. This process involves two possible cases.
This is the simpler case of the two, where you need to use the Source schema drop-down list to select the same source schema next to each required target schema.
This is the more complex case where you will need to avoid unwanted table duplication.
1. Use the Source schema drop-down list to select the same source schema next to each required target schema.
2. Click Compare. In the resulting comparison document, you will see that the previously absent tables will be created in all target schemas after the synchronization.
3. In order to avoid unwanted table duplication, you can use filtering.
For example, we are mapping a schema called Sales to three different schemas (Sales_dev, Sales_Sandbox, and Sales_Test). Additionally, we want a table from Sales to be mapped only to Sales_dev. To do that, we enter the table name in the filter text box and clear the checkboxes next to Sales_Sandbox and Sales_Test to exclude them from mapping. Thus we will not get any unwanted duplicates.
Note
In the Search box, you can also use the following keyboard shortcuts:
- Ctrl+A to select all.
- Ctrl+Left Arrow (←) to move the caret to the beginning of the word.
- Ctrl+Right Arrow (→) to move the caret to the end of the word.
- Ctrl+Shift+Left Arrow (←) to select text from the current caret position to the beginning of the current word and move the caret to the beginning of the word.
- Ctrl+Shift+Right Arrow (→) to select text from the current caret position to the end of the current word and move the caret to the end of the word.
- Ctrl+Backspace to delete the word to the left of the cursor.
4. When you filter out all the unwanted duplicates, you will get a result similar to the following.
Note
If you don’t filter out the unwanted duplicates, you will most likely have to delete them later on, which is going to be more time-consuming.
5. Go to the Comparison menu > Synchronize to open the Schema Synchronization Wizard. Configure additional synchronization options, if necessary, and click Synchronize.
To compare only the schemas that have been mapped automatically, you can use the Compare only mapped schemas option, which can be enabled by selecting the corresponding checkbox on the Schema Mapping tab of the New Schema Comparison wizard.
Thus, with the option enabled, all unmapped schemas will be excluded from the comparison.
The mapping results will be similar to the following.