Oracle cross-database query of replicated table data

Source: Internet
Author: User

Method 1 of Oracle cross-database query and replication table data: currently, most databases require distributed query. The following describes how to configure cross-database access in oracle. For example, there are two database servers and two databases are installed. Database server A and B. Now, database A accesses database B. Step 1: Configure tnsnames on server. ora file (TNSNAMES. ORA Network Configuration File), where the File is stored: $ ORACLE_HOME/network/admin/tnsnames. ora needs to add configuration items for database B in this file. The format is ZBCDB3 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 10.1.50.6) (PORT = 1523) (CONNECT_DATA = (SERVICE_NAME = zbcdb3) if another client in database A accesses database B, at the same time, you should modify the corresponding files of the client. Step 2: create A data DBLINK for B in A database of server. Syntax: create database link dcmdb connect to dcmdb identified by dcmoptr using 'zbcdb3'; then you can implement distributed query: select * from where 1 = 1; Method 2: first create a database link: create public database link Data LINK name connect to login username identified by password USING (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = ip address of the other Oracle Server) (PORT = PORT number) (CONNECT_DATA = (SERVICE_NAME = service name of the target Oracle Server) 'the Data Link name is added to the local Oracle Database Console (Oracle Enterprise Manager Console) the TableName statement for the service name of the Tree node to query the table of the other database is as follows: SELECT field name FROM TableName @ Data Link name; copy table data: insert into Table Name (field name) (SELECT field name FROM TableName @ Data Link name );

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.