This article explains how to use the Schema mapping (aka owner mapping) feature to map objects with the same structure but different schema names.
The Schema mapping feature can be used for custom mapping of database objects with different schema names without changing schema names in any of databases. In this article, ApexSQL Data Diff will be used as an example tool, but the mapping customization is the same for ApexSQL Diff and ApexSQL Script.
Press and hold the CTRL key to select multiple schemas and exclude them at the same time, or use Delete all option from the right side to remove all existing schema mappings
The excluded schemas will no longer be on the Schema mapping list, or the list will be empty if the Delete all button was used.
To change some existing schema mapping, select the schema from the left (source) or the right (destination) side and change it to desired schema by selecting it from the drop-down list:
After selecting desired schema from the source or destination (source in this case) they will be shown as mapped:
In ApexSQL Data Diff, project is saved with .axdd extension, as that is its default extension
More about using a project file can be found here.
The Schema mapping feature has an option to save some particular custom-made schema mapping and re-use it later. That can be accomplished using the following steps:
After clicking the Export button, select a location to save schema mappings and specify the name of the schema mapping (Schema mapping Books in this case), then click the Save button:
To load already saved mapping, use the Import button from the upper right corner of the Schema mapping tab:
Select the saved schema mapping from its location and click the Open button:
Q: Can I map one schema twice to two different schemas?
A: Yes. One schema can be mapped twice, for example, first time it is mapped automatically with the schema with the same name, and second time custom with the schema with the different name:
Q: Can I add more schema mappings at once?
A: No. Schema mappings can be added only one-by-one.
Q: Can compare with custom schema mapping through CLI?
A: Yes, schema mappings can be used via the CLI with the owners mapping switch: /schema_mapping:schema_mapping_file_path (e.g. /schema_mapping:“Schema_mapping.axmp”). This switch will override any schema mappings that exists in a project that is being used. More about CLI switches can be found here.