Showing Differences Between Real Databases and Database Schema
As a basis for target-directed customizations, you can view the differences between the relational database's database schema and the database model's data schema.
Prerequisites
You require
- A relational database with the respective login information or
- A DDL file
and
- A model with at least one database schema that contains physical elements, i.e. tables and views.
Context
You can use the comparison to show the differences between physical elements of the relational database or the DDL file and the elements mapped in the database model. You can use this information to decide which database elements you want to put in your model or which ones you want to update.
Use the Database Import Wizard or DDL Import Wizard to import comparison information from a relational database or a DDL file; here you can select the respective source and the table to be imported from it, as well as selecting the database model's data schema as the comparison target.
The source and target side are compared with each other in the Database Manager editor. You switch the display on or off by activating or deactivating the Database Connection>Source>Compare with Model toggle menu command. The DB Manager editor needs to be the focus.
The differences are only shown for real database elements in the left list of the tool window and for their subelements that are shown in the bottom area of the tool window once an element has been selected. Differences are only shown for elements with the check box checked in the list's first column.
If you also want to show the differences for other elements, then you need to select these and open Compare with Model again.
The differences between the physical elements and those in the database model are shown by the font color and a tool tip. The following displays are possible:
| Color | Tool tip | Description |
|---|---|---|
| Black | The element exists in the target schema; all of its properties and subelements are also consistent. | |
| Green | The element doesn't have a corresponding element in the target schema. | The element only exists in the database or DDL file. |
| Blue | The element differs from its corresponding element in the target schema. | The element already exists in the target schema but has different properties or subelements. |
| Red | The element doesn't exist here but only in the target schema. | The element only exists in the target schema but not in the database or DDL file. This difference is only shown for subelements. |
Comparing a Relational Database with a Modeled Database Schema
How to proceed
-
Select Import/Export>Import>Relational Database.
The Database Import Wizard appears.
-
Select the database connection in question and click on Next.
The wizard jumps to the next step. A connection is made to the configured database selected in the database connection. The database objects from the schema of the relevant relational database are listed.
-
To select the database objects that you want to import from the connected database, activate the relevant check boxes and click on Next.
The wizard jumps to the next processing step, where you select the import variant.
-
To compare the imported database schema with the modeled schema, click the Advanced import button.
The wizard closes and you are connected to the database.
The
DB Manager opens and the Database Connection ribbon tab is active. A list of the database objects from the schema of the relational database is displayed on the left-hand side. -
If the comparison schema is not yet preallocated or if you want to select a different one, select the schema for the comparison from the (Nicht definierte Variable:UIVar_Win.DBImportTarget) drop-down list at the top right.
-
On the left-hand and right-hand side, activate the check boxes for all of the database elements from the connected database or target package of the data model that you want to compare with each other.
-
To show the differences, select the toggle command Database Connection>Source>Compare with Model.
All differences between the selected elements from the relational database and the existing database schema in the model are determined and visualized in the editor.
The differences are shown in the left-hand list of imported elements and in the list of subelements in the bottom area of the editor in a different color and with a tool tip. The elements that already exist in the target schema are displayed in Black, non-existent elements are displayed in Green, elements with different properties and subelements are displayed in Blue, and deleted subelements are displayed in Red.
Comparing a DDL File with a Modeled Database Schema
How to proceed
-
Select the database schema in the model that you want to compare with the schema of a DDL file.
-
Select Import/Export>Import>DDL File.
The DDL Import Wizard appears.
-
To select a DDL file, click on
.The Open dialog appears.
-
Select the DDL file and confirm with Open.
The DDL file's path is shown.
-
Select a database schema for the comparison and click on Next.
The wizard jumps to the next step. All available database objects in the DDL file are displayed in the wizard.
-
To select the database objects that you want to compare from the DDL file, activate the relevant check boxes and click on Next.
-
To open the
DB Manager editor for the comparison, click on Advanced Import.The wizard closes.
The
DB Manager opens and the Database Connection ribbon tab is active. A list of the database objects from the DDL file is displayed on the left-hand side. -
If the target package is not yet preallocated or if you wish to select another schema as target, select this from the drop-down list at the top right in the editor.
All database elements found in the schema are shown in the list on the right-hand side.
-
To select a database element you want to show the differences for, activate the relevant check box.
-
To show the differences, select the toggle command Database Connection>Source>Compare with Model.
All differences between the selected elements from the DDL file and the existing database schema in the model are determined and visualized in the editor. The differences are shown in the left-hand list of imported elements and in the list of subelements in the bottom area of the editor in a different color and with a tool tip. The elements that already exist in the target schema are displayed in Black, non-existent elements are displayed in Green, elements with different properties and subelements are displayed in Blue, and deleted subelements are displayed in Red.
