Home » RDBMS Server » Networking and Gateways » Connecting to Remote Server
Connecting to Remote Server [message #162976] Tue, 14 March 2006 06:50 Go to next message
ramsat
Messages: 49
Registered: November 2005
Member
Hai,

Consider i have 2 Databases DB1,DB2

DB1 is located in INDIA
DB2 is located in US

Now how to connect to DB2 from DB1 and
also please tell me how to create a DB_Link for this scenario

Thank U in Advance

Ramesh!
Re: Connecting to Remote Server [message #163170 is a reply to message #162976] Wed, 15 March 2006 05:15 Go to previous messageGo to next message
tarundua
Messages: 1080
Registered: June 2005
Location: India
Senior Member


Yes , DB link is the right way.

And for information regarding DB links, read Oracle manual.
Re: Connecting to Remote Server [message #163923 is a reply to message #162976] Mon, 20 March 2006 17:42 Go to previous message
nmacdannald
Messages: 460
Registered: July 2005
Location: Stockton, California - US...
Senior Member
Database links.

Okay, here is the deal. I just spent two days reading about something that a person can explain in two minutes.

1) Make sure your tnsnames.ora have the same correct entries on both local and remote databases.
then lsnrctl reload
The listener.ora may have some role in connecting?

2) create a public database link on the local database:
As sys (or a user that can create dblinks):
CREATE PUBLIC DATABASE LINK xxDBLINK
CONNECT TO LINKUSER
IDENTIFIED BY <a valid password>
USING '<a service name in your tnsnames.ora file that points to the remote database>';

3) On the remote database, create a user for the link to use:
CREATE USER LINKUSER IDENTIFIED BY <the valid password above>
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE TEMP
PROFILE <an appropriate profile>
ACCOUNT UNLOCK;
4) GRANT CONNECT TO LINKUSER;
or perhaps
grant create session to linkuser;

5) grant object priveleges to select, and/or update, and/or delete, and/or insert for the remote table to the new linkuser:
grant select on scott.<a table>@xxDBLINK;

6) back on local database, create a public synonym:
create public synonym <remote table name> for <remote table owner>.<remote table name>@xxDBLINK;
Make sure local table names don't match table names on remote database. If so, then change the synonym name slightly.

7) Test it:
Then on your local database:
select count(*) from <tablename>

Unless I missed something. This works for Solaris 9 Oracle 10.2.0.1. to Linux Oracle 10.1.0.3. Watch out for firewalls or anything that would stop the two databases from seeing each other.
Happy linking!
Neil.
Previous Topic: Solaris 9, 8.1.7 Oracle Financials - database link ora-980
Next Topic: ORA-12154 tns:could not resolve the connect identifier specified
Goto Forum:
  


Current Time: Mon Apr 29 09:29:50 CDT 2024