Oracle DBLinke + materialized view synchronize data of two databases

Source: Internet
Author: User

The new requirement for Oracle DBLinke + Materialized View to synchronize data projects of two databases is to synchronize some of the two Oracle databases. Several methods are available in the experiment environment, today, we will record how DbLink and the materialized view synchronize data. 1. Configure the tnsnames. ora file to specify the Network Name of the master database. The experiment environment is 169db. 2. Assign the corresponding permissions grant create database link to repadmin; -- create dblink on the slave database. Grant create materialized view to repadmin; -- permission for creating materialized views. 3. log on to the slave database as repadmin. Connect repadmin/xxxx -- create dblinkcreate database link 169 dbLink connect to repadmin identified by xxxx using '169db'; -- test whether the select * from global_name @ 169 dbLink is created successfully; 4. Create a materialized view log on the table of the primary database. This log records the changes in the primary table. Create materialized view log on pdata; -- If Pdata does not have a primary key, you can use rowid as the primary key. Create materialized view log on pdata with rowid; 5. create a materialized view from the database. Create materialized view test refresh fast with primary key start with sysdate next sysdate + 1/1440 as select * from pdata @ 169 dblink; -- fast auto refresh is used here. Sysdate + 1/1440 is refreshed every minute. 6. Complete. You can Insert or Update pdata tables in the primary database. The materialized views in the database are automatically updated.

Related Article

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.