Test Conditions for recording specific steps of DBLINK creation in Oracle

Source: Internet
Author: User

Today, we will mainly talk about the conditions for record testing of the specific steps for Oracle to establish DBLINK. For example, a company has a subsidiary in Xinjiang. In this test, the Local Computer in Xinjiang is used as the local computer, that is, the required IP address is 192.168.1.100.

The headquarters in Beijing has a centralized database with the sid sidbj, Username: userbj, password: bj123, and Beijing IP Address: 192.168.1.101.

A local branch in Xinjiang also has a database whose SID is SIDXJ, user: userxj, password: xj123, and IP address of Xinjiang is 192.168.1.100.

Access Data in the SIDXJ database in the local Xinjiang region to the SIDBJ database in Beijing.

That is to say, in the sidxj database, the user userxj (192.168.1.100) needs to establish a DBLINK to access the data in sidBJ (192.168.1.101) as userbj.

Test environment: Both databases are created on WINXP, and Oracle versions are Oracle817.

When creating an environment in Oracle, you must disable the Windows Firewall on the two computers. Otherwise, ping may occur, but the Oracle connection may fail.

1. Q: How to return the GLOBAL_NAME of the database?

Run

 
 
  1. SELECT * FROM GLOBAL_NAME; 

The GLOBAL_NAME of the database in Beijing is SIDBJ. US. ORACLE. COM.

The GLOBAL_NAME of the database in Xinjiang is SIDXJ.

2. Q: How can I check whether the Global_name parameter is true or False?

Answer: Execute:

 
 
  1. SQL> show parameter global_name; 

The execution result is as follows:

 
 
  1. NAME TYPE VALUE  
  2. ------------------------------------ ----------- ------------------------------  
  3. global_names boolean TRUE 

This parameter is true.

If this parameter is set to true, the name of the DBLINK created in the local Oracle database must be the same as that of the remote Global_name database.

3. Q: Check whether the remote data producer supports the advanced copy function.

A: Check the v $ option view. If Advanced replication is TRUE, Advanced replication is supported. Otherwise, Advanced replication is not supported.

The execution statement is:

 
 
  1. select * from v$option; 

You can also run the select * from v $ option where PARAMETER = 'advanced replicase' statement,

If the returned value is True, it is supported. Otherwise, it is not supported. Check whether the two databases support this function.

Procedure:

1. Create an Oracle client locally to connect to tns_xj_to_bj, which is used to connect to the database in Beijing.

In a database in Beijing, Oracle creates a table for testing.

 
 
  1. create table USERBJ.BJ_TEST  
  2. (  
  3. STU_ID NUMBER,  
  4. STU_NAME VARCHAR2(100)  

Add a record:

 
 
  1. Insert into BJ_TEST (STU_ID, STU_NAME)
  2. Values (1, 'zhong derong ');

2. Create a connection tnsxj to connect to the local sidxj database and log on to PLSQL using tnsxj, userxj, and xj123.

Create a remote data connection DBLink to Beijing.

 
 
  1. create database link SIDBJ.US.ORACLE.COM connect to userbj 
    identified by bj123 using 'tns_xj_to_bj'; 

Among them: SIDBJ. US. ORACLE. COM is the global_name of the remote database, userbj is the username used to connect to SIDBJ, and bj123 is the password of userbj,

Tns_xj_to_bj is the service name of the database established by the local Oracle to connect to Beijing.

3. test whether the connection is successful:

 
 
  1. select * from dual@SIDBJ.US.ORACLE.COM 

If the following result is returned, the connection is successful.

 
 
  1. DUMMY  
  2. -----  
  3. X  

The above content describes the detailed steps for creating a DBLINK in Oracle, hoping to help you in this regard.

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.