Home » RDBMS Server » Networking and Gateways » Doubt in Create database link command (Oracle, 11.0.7.1.0)
Doubt in Create database link command [message #513557] Tue, 28 June 2011 03:56 Go to next message
Database admin
Messages: 365
Registered: September 2006
Location: india
Senior Member

Hi,

I have a doubt in understanding the concept of creating database link.

The command to create database link as 'P10' user in DB1 database is --

CREATE PUBLIC DATABASE LINK "db_link1"
CONNECT TO BALA
IDENTIFIED BY <secret123>
USING 'DEVSDC.SBC.COM';

I have a doubt in create db link command.

I know this user 'BALA' will exist in remote database .What will happen if
we dont give CONNECT TO BALA IDENTIFIED BY <secret123>

Does this CONNECT syntax means that it will connect to the user 'BALA'
in remote database from local DB1 database to access BALA user objects ?

Can somebody clarify my doubt ?

Thanks
Re: Doubt in Create database link command [message #513567 is a reply to message #513557] Tue, 28 June 2011 04:56 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
What will happen if we dont give CONNECT TO BALA IDENTIFIED BY <secret123>

It tries to connect to the remote database with the current user and password.

Regards
Michel
Re: Doubt in Create database link command [message #513582 is a reply to message #513567] Tue, 28 June 2011 05:36 Go to previous messageGo to next message
John Watson
Messages: 8922
Registered: January 2010
Location: Global Village
Senior Member
There is another possibility. You can have a public database link that specifies USING but not CONNECT TO, and a private database link with the same name that specifies CONNECT TO but not USING. Then when you use the link your session will search your private namespace and find the incomplete link, then to go to the public namespace to find the other incomplete link to complete it. This means that you as DBA can control the networking through public links, and your users then create theor own provate links that specify their passwords (which you wouldn't know).

Re: Doubt in Create database link command [message #513589 is a reply to message #513582] Tue, 28 June 2011 06:05 Go to previous messageGo to next message
Database admin
Messages: 365
Registered: September 2006
Location: india
Senior Member

Thanks john,

Michel,

I have one quick question for you.

"It tries to connect to the remote database with the current user and password"


what is current user and password here ? Are you talking about local database user ?

Thanks

[Updated on: Tue, 28 June 2011 06:06]

Report message to a moderator

Re: Doubt in Create database link command [message #513599 is a reply to message #513589] Tue, 28 June 2011 06:27 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
The one that is refering/using the database link.

Regards
Michel

[Updated on: Tue, 28 June 2011 06:28]

Report message to a moderator

Re: Doubt in Create database link command [message #513615 is a reply to message #513599] Tue, 28 June 2011 06:58 Go to previous messageGo to next message
Database admin
Messages: 365
Registered: September 2006
Location: india
Senior Member



You mean user 'P10' user per my db link command ?
Re: Doubt in Create database link command [message #513644 is a reply to message #513615] Tue, 28 June 2011 08:24 Go to previous messageGo to next message
John Watson
Messages: 8922
Registered: January 2010
Location: Global Village
Senior Member
Why don't you just test it?
orcl> create database link l1 using 'orcl';

Database link created.

orcl> select username from v$session@l1 where sid=(select distinct(sid) from v$mystat@l1);

USERNAME
------------------------------
JON

orcl> create database link l2 connect to scott identified by tiger using 'orcl';

Database link created.

orcl> select username from v$session@l2 where sid=(select distinct(sid) from v$mystat@l2);

USERNAME
------------------------------
SCOTT

orcl>
Re: Doubt in Create database link command [message #551924 is a reply to message #513644] Sun, 22 April 2012 10:40 Go to previous message
Database admin
Messages: 365
Registered: September 2006
Location: india
Senior Member

Thank you John for the example.

[Updated on: Sun, 22 April 2012 10:41]

Report message to a moderator

Previous Topic: License required to use OID 11g?
Next Topic: dblink and left join
Goto Forum:
  


Current Time: Fri Mar 29 04:09:07 CDT 2024