How to create a database connection between two oracle instances

How to create a link to a database between two Oracle instances. Suppose A and B are two cases. I want to access the data in instance B from instance A.

+20
source share
5 answers

as a simple example:

  CREATE DATABASE LINK _dblink_name_
   CONNECT TO _username_
     IDENTIFIED BY _passwd_
       USING '$ _ORACLE_SID_'

for more information: http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5005.htm

+10
source

If you want to access the data in instance B from instance A. Then this is a request, you can edit your corresponding credentials.

CREATE DATABASE LINK dblink_passport CONNECT TO xxusernamexx IDENTIFIED BY xxpasswordxx USING '(DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=xxipaddrxx / xxhostxx ) (PORT=xxportxx)) (CONNECT_DATA= (SID=xxsidxx)))'; 

After executing this query, the access table

 SELECT * FROM tablename@dblink _passport; 

You can perform any operation DML, DDL, DQL

+9
source

Linking to DB

CREATE DATABASE LINK dblinkname
CONNECT TO $ usename
IDENTIFIED BY $ password
USING '$ sid';

Example requests for link to link above

select * from table A @dblinkname;

insert into tableA (select * from tableA @dblinkname);

+3
source

After creating a link to the database, if two instances are present in two different databases, you need to configure the TNS record on machine A so that it allows B. read here

+1
source

Create a database link NAME connect to the USER NAME is identified by the PASSWORD using the 'SID';

Specify SHARED to use a single network connection to create a public database link that can be used by multiple users. If you specify SHARED, you must also specify the dblink_authentication clause.

Specify PUBLIC to create a publicly accessible database link that is accessible to all users. If you miss this offer, the link to the database will be closed and available only to you.

0
source

Source: https://habr.com/ru/post/1444549/


All Articles