Oracle build DB-LINK

Source: Internet
Author: User

Oracle build DB-LINK

Test conditions

Two servers

Remote: IP: 192.168.0.18, SID: usertest, usertest, password: 123456

Local: IP: 192.168.8.90, SID: wjn, Username: userwjn, password: mosquito0

Parameter settings

1. view the database global_name

Execute select * from global_name;

Remote database 18 return: USERTEST. US. ORACLE. COM

Return value for the local database 90: DB_WJN.REGRESS.RDBMS.DEV.US.ORACLE.COM

2. view the global_name Parameter

SQL> show parameterglobal_name;

NAME TYPE VALUE

-----------------------------------------------------------------------------

Global_names boolean FALSE

If this parameter is set to TRUE, the name of the local connection DBLINK must be the same as that of the remote global_name.

3. Check whether Advanced Replication is supported.

View the v $ option view. If Advanced replication is set to true, It is supported. Otherwise, it is not supported.

Select * from v $ option t wheret. PARAMETER like 'advanced replication % ';

Creation Method

1. The first way to create dblink is to configure the database to be remotely accessed in the tnsnames. ora file of the local database.

Create database link USERTEST_18connect to USERTEST identified by xxxx using 'usertest _ 192.168.0.18 ';

USERTEST_18 indicates the dblink name you created, usertest indicates the Instance name of the remote database, and USERTEST/xxxx indicates the user/password that logs on to the remote database. Then access the dual table in remote database 18 through dblink in the local database. The SQL statement is as follows:

Select * from dual @ USERTEST_18;

2. The second method for creating a dblink is that the remote database to be accessed is not configured in the tnsnames. ora file of the local database.

Create public database link USERTEST_18

Connect to USERTEST

Identified by 123456 using

'(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.18) (PORT = 1521 ))

)

(CONNECT_DATA =

(SID = usertest)

(SERVER = DEDICATED)

)

)';

The second is to put the first information configured in the tnsnames. ora file directly after the dblink statement is created. In the first case, the information in the tnsnames. ora file is as follows:

USERTEST_192.168.0.18 =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.18) (PORT = 1521 ))

)

(CONNECT_DATA =

(SID = usertest)

(SERVER = DEDICATED)

)

)

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.