Monday, May 14, 2012
Oracle database link with easy connect, RAC, bequeath connection.
The old way of creating a database link in oracle database is to use the syntax
create database link linkname connect to <username> identified by <password> using 'connect_string';
where connect string maps to a entry in tnsnames.ora.
If you did not want to depend on any files in Oracle local directries, then you had the workaround of replacing the connect string with the complelete description as follows.
create database link linkname connect to <username> identified by <password> using
'(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.10.101)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = VIJAY)))';
Now, you can use the same concept and connect using the easy connect syntax as follows.
create database link abc1 connect to <username> identified by <password> using '//10.0.10.101:1521/vijay';
If this is a RAC environment and you need to access one specific instance, then the syntax would be
create database link abc1 connect to <username> identified by <password> using '//10.0.10.101:1521/vijay/vijay1';
If for some reason, you need to create a database link to read data from the same host (loopback ) you could use a bequeath connection in the database as follows.
create database link beq_link connect to <username> identified by <password>
USING
'(description=(address=(protocol=beq)(program=/u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle))
(CONNECT_DATA = (SERVICE = orclprd)))';
Subscribe to:
Post Comments (Atom)
You are the best, I was looking how to create a DB Link between my two databases, Oracle 11g DB and Oracle RAC 11g DB. I have searched in many pages and forums, until I found this and saved my day.... Thanks a lot
ReplyDelete