Introduction to dblink creation in Oracle

Source: Internet
Author: User

As the business volume increases, the amount of data to be stored also increases. If all data is stored in a database, it will inevitably increase the performance consumption of the database. This will eventually lead to user unfriendly feelings. In view of this, we plan to store data in multiple copies to different databases, and databases can access each other. In this case, we need to create a dblink, that is, a domain-based database. Databases are accessed by @ domain name. Applications can also be accessed in this way. In this way, the data with a large volume of traffic is stored in an independent database, and the function configuration data and static data displayed directly to the customer are separately stored in a single database, so that the customer can quickly query and display the data in a friendly manner.

Suppose we have two databases: Database A and database B. We want to access the tables of database B from database A, but B cannot access the tables of database.

The procedure is as follows:

1. on the server of database A, add the following directory/home/Oracle/product/10.2.0/db_1/network/admin/tnsnames. ora:

DBLINK_NAME =

(DESCRIPTION =

(ADDRESS =

(PROTOCOL = TCP)

(HOST = 192.168.5.12) -- ip address of database B

(PORT = 1521)

)

(CONNECT_DATA =

(SERVICE_NAME = ora920) --- database B Instance name.

)

)

2. Run the command on the client of database,

Create database link "DBLINK_NAME"

Connect to INMS20 --- User Name of Data B

Identified by "password"--password of database B

Using 'dblink _ name'; -- domain NAME.

3. Access the data table dual of database B from database A client.

Select * from dual @ dblink_name;

If you want database B to access database A, you can reverse build dblink.

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.