Oracle dblinke+ materialized view the new requirement of synchronizing data items for two databases is to synchronize parts of the two Oracle databases, and now try several methods in the experimental environment, and then record the Dblink and materialized views synchronized data today. 1, configure the Tnsnames.ora file designated to the main database network name, the experimental environment is 169db. 2, at the end of the database to assign the appropriate permissions to the user grant CREATE database link to repadmin; --Creates a dblink permission. Grant create materialized view to repadmin; --the right to create materialized views. 3, log in as repadmin from the database. Connect Repadmin/xxxx--Creating Dblink Create DATABASE link 169dbLink connect to repadmin identified by xxxx using ' 169db '; --tests whether to create a successful select * from Global_name@169dblink; 4. Create a materialized view log on the table of the primary database, which 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 materialized views from the database. Create materialized view test refresh fast with primary key start with Sysdate next sysdate+1/1440 as SELECT * from pdata@ 169dblink; --Here is the fast automatic refresh. Sysdate +1/1440 is refreshed once per minute. 6, complete. You can insert or update the pdata table in the primary database, and the materialized view in the database is automatically updated.
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.