Analytics


Google

Friday, September 19, 2008

Creating Database link in Oracle to without defining remote database in sqlnet

Normally, when we create a database link to a remote database, we will define the alias in SQLNet and then create the database link as follows:

create database link dbtest connect to scott identified by tiger using 'dbtest';


However, it is possible to connect directly by using what is defined in the sqlnet as follows:

create database link dbtest connect to scott identified by tiger using '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = db.blogspot.COM)(PORT = 1521)))(CONNECT_DATA =(SID = orcl)))';

2 comments:

David said...

Thank you!

How do you use the database link created via this method?

Strovek said...

The same as you would for normal dblink. Assuming you have a table in the remote db called emp, so you can perform a select as such:

select * from emp@dbtest;