Oracle Database Link

Source: Internet
Author: User
In ORACLE, remote data access, such as query and update, can be achieved through DatabaseLink. The database connection needs to be run on both databases that have created DatabaseLink.

In ORACLE, remote data access, such as query and update, can be achieved through Database Link. The Database connection must be run on the two sub-hosts that have created the Database Link.

In Oracle, remote data access, such as query and update, can be achieved through Database Link. The Database connection needs to be established on the two machines on which the Database Link is established.Run Oracle Net (formerly SQL * NET and NET 8 ).

Syntax:

1 Create a Database Link:

There are two database servers A/B, where IP address A is 172.20.36.245, and server B is the local machine. The database instance name on server B is ORCL, And the instance configuration on server A is available in the Service Listening configuration on the local machine:

BIWG_TEST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 172.20.36.245) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = biwg )))

The account for BIWG_TEST is WGODS and the password is WGODS.Create DB Links on the local machine

Method 1:

Create public database link wgods. ORACLE. comconnect to wgods identified by wgods using'BIWG'

CREATE [PUBLIC] database link database connection name connect to user name identified by password USING 'instance name of locally configured Data ';

[Public] means that public is a global db link, that is, all users in the database can query, sys or system users are required to create the database (of course, users with sysdba permissions can also). If public is not used, the database link is private. Only users who create the database link can query the database link.

Check whether the connection is successful

SELECT * FROM DUAL@WGODS.ORACLE.COMSELECT * FROM REF.TR_WGG_GDAREA_INFO@WGODS.ORACLE.COM

Method 2: do not configure the service.

Create public database link REMOTE_DEVE_HOSTCONNECT to wgods identified by wgodsusing'(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP) (HOST = 172.20.36.245) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = biwg )))'

This implementation is not recommended. I don't feel the convenience of the above method.

Check whether the connection is successful

SELECT * FROM DUAL@WGODS.ORACLE.COMSELECT * FROM REF.TR_WGG_GDAREA_INFO@WGODS.ORACLE.COM

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.