How to create an oracle db Link

Source: Internet
Author: User

 How to create an oracle db Link

 

Known: database 1: test1; database 2: Test2
Requirement: Create a DB link from database 1 to database 2

Solution 1:

1. on the computer where database 1 is located, create the service name to database 2: orl_test2
2. Create a DB link between database 1 and database 2 on database 1 or other computers with Oracle clients. The method is as follows:
* Log on to SQL * Plus and enter "CREATE DATABASE LINK ".Link_nameConnectUserIdentifiedPassUsing'Orl _ test2';
(Link_name: DB Link name;User: Database username;Pass: Database Password;'Orl _ test2': Name of the database service that is locally connected to test1, enclosed in single quotes)
3. Delete the DB link. The method is as follows:
* Log on to SQL * Plus and enter drop public database link.Link_name

 

Solution 2:

Create a database link from database 1 to database 2 directly on database 1 or other computers with Oracle clients. The method is as follows:

Log on to SQL * Plus and enter CREATE DATABASE LINK.Link_nameConnectUserIdentifiedPassUsing
'(Description =
(Address_list =
(Protocol = TCP) (host =IP address of the computer where database 2 is located) (Port = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME =Test2)
)
)';

(Link_name: DB Link name;User: Database username;Pass: Database Password ;)

 

Delete dB Link

Log on to SQL * Plus and enter DROP DATABASE LINK.Link_name;

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.