Solved

Oracle -- Database LINK -- on two different servers

Posted on 2011-02-21
8
803 Views
Last Modified: 2013-12-19
Doing the below works when i have two databases (test & dev) on the same machine (server1)

How can I do the same logic, but on different machines ?

Example = dev is on server1 and test is on server2

create public database link
  dev123     -- user defined, can be anything
connect to
  hr            -- DEV's user
identified by
  .....            -- DEV's password
using 'dev'; -- DEV's SID

create public database link
  test123     -- user defined, can be anything
connect to
  hr            -- test's user
identified by
  .....            -- test's password
using 'test'; -- test's SID

insert into accounting_structure_tab@dev123
select *
from accounting_structure_tab@test123;
0
Comment
Question by:finance_teacher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 500 total points
ID: 34945497
you do it the exact same way


the only "trick" is you need to make sure your tnsnames.ora (or ldap if using that) is configured on DEV so your DEV db can find your TEST db on the other server.
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 34945510
also, you don't need (or want) 2 database links.


you only want one link, from the target system linking to the source system.

In your case, you want one link on dev that connects to test.
0
 
LVL 10

Expert Comment

by:Bawer
ID: 34945532
try this format

Select * from [ServerName].[DatabaseName].[Scheme].[TableName]
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 74

Expert Comment

by:sdstuber
ID: 34945560
Bawer,

that's sqlserver syntax,  doesn't apply here
0
 
LVL 18

Expert Comment

by:sventhan
ID: 34945702
If you do not want to use DB link, you could use SQL Plus copy command. Its over the wire and does not require a DB link.

http://download.oracle.com/docs/cd/B10501_01/server.920/a90842/apb.htm
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 34945719
dblink is more efficient, it allows direct insert from source to target

COPY will copy all of the data locally to you client  from the source then do inserts from your client to the target

if the table is small you might not notice the lag but if it's large, dblink is definitely the way to go
Note, you can't copy  LONG type across the dblink but COPY will allow it.  Hopefully you aren't using LONG types though, they were deprecated years ago
0
 
LVL 18

Expert Comment

by:sventhan
ID: 34945734

COPY FROM username/your_password@db-
append accounting_structure_tab-
USING select * -
from accounting_structure_tab
0
 
LVL 3

Expert Comment

by:gopisera
ID: 34948471
Here is the syntax for your question.

create database link name connect to <username> identified by <password of user> using 'tnsentry';
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Oracle Verification of DataPump Export and Import 17 68
Problem with duplicate records in Oracle query 16 52
Fill Null values 5 36
format dd/mm/yyyy parameter 16 48
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question