Created by Marydon on 2018-04-14 12:02
1. scenario demonstrates
When you need to access data from database B A library, it is necessary to connect these two libraries;
How the two databases to achieve interoperability, the oracle can be achieved through the establishment of DBLINK.
2. Solution
2018/12/05
Step 1: Create DBLINK
Premise: To establish two IP communications database must implement access to each other.
Method 1: Use plsql achieve
Select the "database link" -> right click -> New
Name: The name DBLINK created through which to access the complete library of B;
B configuration required to connect the library user name, password, and database address
Second way: through sql realization
Method One: recommended
Create Database Link DATABASE_LINK_TEST - database alias Connect to DB_TEST IDENTIFIED by DB_TEST - on the application of a username and password the using ' 127.0.0.1:1521/ORCL ' ; - Name: port number / database instance
Method Two:
template
the Create Database Link just a name Connect to the username IDENTIFIED by password a using ' (the DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = domain) (PORT = port number)) ) (CONNECT_DATA = (SERVICE_NAME = database examples name) ) ) ' ;
For example:
- the Create Database Link the Create Database Link DATABASE_LINK_TEST - a custom database name to connect Connect to username IDENTIFIED by password - username and password a using ' (the DESCRIPTION = - Database Connection: domain name, port number, database instance (ADDRESS_LIST = ( = ADDRESS (= the PROTOCOL the TCP) (the HOST = 127.0.0.1) (PORT = 1521)) ) (the CONNECT_DATA = (SERVICE_NAME = ORCL) ) ) ' ;
Step two: Call mode
B database alias name of the database table B @ connection
select * from BASE_TEST@DATABASE_LINK_TEST