Lesson 8 | Overview of Oracle's topology solution, part 2 |
Objective | Describe the role of database links in establishing database connectivity. |
Take Service Name, Add remote user ID, password
Role of Database Links in establishing Database Connectivity
Having defined a service name, the next step in establishing database connectivity is to create database links that take the service name
and add a remote user ID and password. Once defined by the DBA, these remote databases can participate in queries and updates from within any
Oracle application. For example, databases in London and Paris can be defined to the Denver system with the following SQL extension:
CREATE PUBLIC DATABASE LINK london
CONNECT TO 'user_id' IDENTIFIED BY 'secret_password'
USING 'london_unix';
CREATE PUBLIC DATABASE LINK paris
CONNECT TO 'user_id' IDENTIFIED BY 'secret_password'
USING 'paris_vms';
Note that the USING
clause of the database link specifies a TNS service name.
This service name will be looked up in the tnsnames.ora file to get the protocol, IP address, and the database system ID (SID) name.
The next lesson concludes our examination of Oracle's topology solution by looking at how to join tables from remote sites in a SQL query.
<2>The USING clause
The optional USING clause supplies the connect string that the database link is to use:
USING 'prodsales'
Although this clause is optional, you must supply it unless there is already a public database link to the destination database using the desired connect string.
How Database Links Are Resolved
A database can easily have multiple database links with the same name. For example, several users may have private links to the same remote database, and there may also be a public database link to this remote site. Oracle requires a username and a connect string to establish a connection over a database link. Oracle does not necessarily obtain these two pieces of information from a single database link. So, when a user references an object at the remote site.