How to deploy Oracle database link correctly

Source: Internet
Author: User

The following articles mainly introduce the actual operation steps of the distributed Oracle database link and the description of what I should pay attention to during actual operations, if you are interested in the actual operations, you can click to view the following articles.

Access Method:

 
 
  1. select * from MyTableSpace.MyTable@MyDB 

1. Create a private connection

 
 
  1. Create database link fmydb connect to lpuser identified by lpuser1 using 'lp10. 119.40.7'
  2. Drop database link fmydb [Note that public is not available here]

2. Create a public connection

 
 
  1. Create public database link fmydb connect to sys identified by sys using 'lp10. 119.40.7'
  2. Drop public database link fmydb [Note that public is required here]

The difference between public and public is that if public is available, all oracle users on this machine can query remote databases, if no public account is available, only the user who creates the connection on the machine has the right to query the remote database.

If you create a global dblink, you must use either mongom or sys.

I. Two creation methods

First:

1. Use Net Manager to set up remote services and listeners based on remote information.

2.

 
 
  1. create public database link fwq12  
  2. connect to fzept identified by neu  

Using 'fjept '// fjept indicates the service name Just configured.

Second:

Directly create a link:

 
 
  1. create database link linkfwq  
  2. connect to fzept identified by neu  
  3. using '(DESCRIPTION =  
  4. (ADDRESS_LIST =  
  5. (ADDRESS = (PROTOCOL = TCP)(HOST = 10.142.202.12)(PORT = 1521))  
  6. )  
  7. (CONNECT_DATA =  
  8. (SERVICE_NAME = fjept)  
  9. )  
  10. )';  

Create synonym name FOR table name;

Create synonym name FOR table name @ Database Link name;

Delete dblink: drop public database link linkfwq.

If you create a global dblink, you must use the mongom or sys user and add public before the database.

 
 
  1. SQL>create synonym bjscottemp for emp@beijing; 

Therefore, you can use bjscottemp to replace the Distributed Link operation with the @ symbol emp @ beijing.

ORA-02019: Description of remote database connection not found

1. >>> create a DATABASE LINK

 
 
  1. CREATE PUBLIC DATABASE LINK ABC  
  2. CONNECT TO SA IDENTIFIED BY PASSWORD  
  3. USING '(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = 192.168.0.100)
    (PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = AAA)))';  

2. >>> Test

 
 
  1. select * from test@ABC 

3. >>> note the settings of GLOBAL_NAME in INIT. ORA when using DBLINK,

If it is true, use the full name of DBLINK, which can be found in all_db_links. If it is FALSE, do not use the full name.

Use the full name, such:

 
 
  1. select * from test@ABC.US.ORACLE.COM 

4.

 
 
  1. SQL> select * from global_name;  
  2. GLOBAL_NAME  
  3. LOCALSR  

5. >>>> update global_name set GLOBAL_NAME = 'localsr. US. ORACLE. com' where GLOBAL_NAME = 'localsr'

6. >>> restart routine> OK

 
 
  1. SQL> desc global_name;  
  2. Name Type Nullable Default Comments  
  3. GLOBAL_NAME VARCHAR2(4000) Y global database name   

The above content is the description of Oracle database link, hoping to help you in this regard.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.