Tips & Tricks - Db-Links, JOINS

The examples below are just suggestions, and shows how a JOIN may be set up, and how to create a Db-Link.

Contents

Defining a JOIN

Jobs using procedure MIGRATE_SOURCE_DATA may specify any Oracle data-sources in Source Name. In this example we read data from a database link, JOINing PART_CATALOG and INVENTORY_PART


Adding Methods/Mapping Columns

As we enter rows in the Method List, we know that the columns from View Name will be added to folder Source Mapping. Now, we would like table alias A and B from Source Name above to be prefixed to the Source Column. Last column on the Method List is named Source Name, and is intended for this purpose.
Here you can enter a source that will be matched with View Name. You may also apply an alias for your source.   



Note that the columns in Source Column are mapped from the current database, and is not necessarily present at the remote database.

You must therefore always check the select (RMB Show Select Statement in header) by executing it in PL/SQL Developer f.ex.

Also note that OBJID is not prefixed, you have to do that manually.

 

Create DB-link

CREATE DATABASE <dblink name>
CONNECT TO <user> IDENTIFIED BY <passw>
USING '<connect string>'

The connect string can be the name of the DB in tnsnames.ora (on the Oracle server) , or it can be a complete SQL*Net address, like

(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=nnn.nn.nn.nn)
(PORT=nnnn)))(CONNECT_DATA=(SERVICE_NAME=XXXX)))