In local database, it has to create DB LINK through CREATE DATABASE LINK
.
-
What about remote database side, what does it have to do?
-
On
fixed user link
, local database need to knowID
andpassword
set.
Is theID
is a usual account with which someone can access to the remote database without DB LINK or theID
is only forDB LINK
?
Best Answer
There must have Oracle Net installed on both local and remote database servers. And the user being used should have
CREATE SESSION
system privilege on the remote database.You can have to options to connect to the remote database, one is using current user and another is fixed user which can be defined explicitly after
CONNECT TO
clause. That user is a remote user which must be exist on the remote database server and must haveCREATE SESSION
privilege . If you omit this then currently logged in user is used to access tables on the remote server.Look at the above example. I have connected to the local database as SCOTT user and create two dblinks to connect to the remote server called 'account' using 'account' TNSNAME.
First dblink
dblink1
uses current user which is SCOTT in our case is used in order to select * from emp at the remote server 'account'. In the example the select statement has returned an error stating that the SCOTT user at the remote site is locked.The second dblink
dblink1
uses the fixed user called jay hence this dblink can be used to access tables owned by Jay schema as well as other tables according to the privileges the user has got.For details please refer to the Oracle Documentation. CREATE DATABASE LINK