How to compare tables in Oracle using dbForge tools

This tutorial will take you through the comparison process of the two Oracle tables, showing you a quick and convenient approach to finding differences in data by means of the dbForge tool, Data Compare for Oracle.

This tutorial shows how easy it is to compare tables in Oracle with dbForge Data Compare.

  • Compare 2 tables in Oracle to detect changes
  • Compare columns and rows in the same table
  • Find differences between two tables and analyze them
  • Generate data comparison reports
  • Generate custom scripts to synchronize databases effortlessly

1. Opening Data Comparison Wizard

Click New Data Comparison on the Start page to launch Data Comparison Wizard. You can also start other common tasks in one click without searching for a required command in the menu.

Tip: To open previous comparison projects, double-click them.

dbForge Data Compare for Oracle: Opening Data Comparison Wizard

2. Selecting database connections

To create a database connection, click the New button in the wizard. The Database Connection Properties window appears. You can use either a direct or an Oracle client connection.

Select the Direct checkbox to connect directly. Specify the host, SID, port, user and password to connect to the Oracle server. Click OK to finish. Now you can select this connection in the drop-down list of the Connection field in the wizard.

dbForge Data Compare for Oracle: Selecting database connections

3. Selecting Source and Target for comparison

Source is the database whose contents are inserted into Target during synchronization. Target is the database whose contents are compared and synced with Source. Click the Connection fields and select required connections for Source and Target from the drop-down list.

To swap Source and Target, click the Swap button. To set up custom mapping, click the Next button. To start the comparison, click Compare.

dbForge Data Compare for Oracle: Selecting Source and Target for comparison

4. Selecting comparison options

You can customize comparison behavior, e.g. ignore certain objects or properties. Go to the Options wizard page and select required checkboxes.

Tip: Save the comparison settings as a command line arguments file by clicking the link at the top. You can use this file later for auto-comparison and synchronization via command line.

Tip: To save the current selection of options as your defaults, click Save As My Defaults.

dbForge Data Compare for Oracle: Selecting comparison options

5. Mapping custom objects

dbForge Data Compare offers both automatic and manual (custom) mapping. Use custom mapping to map tables, columns, and views that cannot be mapped automatically.

Tip: To discard custom mapping and restore to the default one, click the Reset button.

dbForge Data Compare for Oracle: Mapping custom objects

Mapping tables and views

You can map tables and views with different data structures manually in several clicks.

Click the Map Objects button. Select Source and Target objects in the open window, then click OK. The selected pair of objects will appear in the grid on the Mapping wizard page and be compared.

Tip: To map multiple pairs of Source and Target objects without closing and opening the window multiple times, click the Map button after the first selected pair of objects. When you manually select all required objects, click OK to see them in the grid on the Mapping wizard page.

dbForge Data Compare for Oracle: Mapping tables and views

Mapping columns

See how many columns of each object can be compared in the Comparison field of the grid.

Click the ellipsis button for the required object. A window will open and show all the columns of the selected object, as well as additional information.

Automatically mapped columns are marked with a green icon. Incompatible columns are marked with a red icon. Select required Target columns from the drop-down list and click OK.

dbForge Data Compare for Oracle: Mapping columns

Mapping custom queries

Click the Custom Query button and write required queries for Source and Target in the corresponding SQL fields. You can select to map the query result with a table. Click Map to perform mapping and OK to close the window.

Tip: To validate queries, click the Validate button or select the Validate item from the context menu in the required SQL field.

dbForge Data Compare for Oracle: Mapping custom queries

6. Analyzing comparison results

See the full info about the compared objects in the data comparison document. The top grid shows all the compared objects. The bottom grid shows the records of the selected objects, automatically grouped by status - Identical, Different, Only in Source, and Only in Target.

Select required objects or separate records of objects to synchronize.

Tip: For better understanding, filter the objects in the top grid, e.g. to see Only in Source objects.

dbForge Data Compare for Oracle: Analyzing comparison results

7. Synchronizing data

Use Data Synchronization Wizard to generate a standards-driven synchronization script and tune up the results according to your needs. Click the Synchronize button to generate the synchronization script immediately.

Tip: To customize synchronization, click Next and proceed to other wizard pages.

dbForge Data Compare for Oracle: Synchronizing data

Customizing synchronization

On the Options page, you can customize synchronization with a variety of options.

To see the synchronization actions and the list of warnings generated during the mapping stage, go to the Summary page.

dbForge Data Compare for Oracle: Synchronization options

Checking warnings

On the Summary page, you can check the synchronization action plan and the list of warnings generated during the mapping stage.

dbForge Data Compare for Oracle: Synchronization plan

Executing the sync script

Now Data Synchronization Wizard provides you with the synchronization script. Click the Execute button on the toolbar to execute it.

dbForge Data Compare for Oracle: Synchronization script

8. SQL script management

Use the SQL editor to view and edit synchronization scripts, create queries and execute them against the selected database.

Click the New SQL button to open the SQL editor.

Tip: When the query is executed, see the query results in the Data window. You will find rich data management options in the right-click menu.

dbForge Data Compare for Oracle: SQL script management

Conclusion

This is how you can compare tables in Oracle quickly and easily, find any differences at a glance, and take corresponding actions. Go through individual records or group them together. Create SQL scripts to deploy data modifications between your environments.

dbForge Data Compare for Oracle

Get your free 30-day trial of dbForge Data Compare to evaluate its capabilities under a sleek user interface.