Get the App
SLTechnology News&Howtos  ›  Database  › 

How to realize distributed replication Environment with materialized view

Shulou Source: shulou.com Published: 2022-05-31 18:28:29 10月01日 Update

This article mainly introduces "how to realize distributed replication environment in materialized view". In daily operation, I believe many people have doubts about how to realize distributed replication environment in materialized view. Xiaobian consulted all kinds of materials and sorted out simple and easy operation methods. I hope to help you answer the doubts of "how to realize distributed replication environment in materialized view"! Next, please follow the small series to learn together!

###############################################

1. Set up snapproxy user at primary site

create user snapproxy identified by "snap001snap" default tablespace users;

BEGIN

dbms_repcat_admin.register_user_repgroup(

username => 'snapproxy',

privilege_type => 'proxy_snapadmin',

list_of_gnames => NULL);

END;

/

grant create session,select any table to snapproxy;

2. Create materialized view logs for tables at the master site with the owner of the table to be replicated: (hr user here)

conn hr/hr;

create snapshot log on employees with rowid,primary key;

create snapshot log on departments with rowid,primary key;

3. Target users who create replication tables at materialized view sites:

create user mview identified by mview default tablespace usres;

grant connect,resource,create snashot,create database link to mview;

4. Create materialized views at materialized view sites Refresh users and empower them:

create user snapadmin identified by "snap001snap" default tablespace users;

EXECUTE dbms_repcat_admin.grant_admin_any_schema('snapadmin');

grant comment any table,lock any table,create any materialized view,alert any materialized view to snapadmin;

5. Create dblink and materialized view to snapproxy user as materialized view user mview at materialized view site:

create database link presale connect to snapproxy identified by "snap001snap" using '130.84.208.52:1621/presale';

create materialized view employees_mv refresh fast as select * from hr.employees@presale;

create materialized view departments_mv refresh fast as select * from hr.departments@presale;

6. snapadmin user creates refresh group

begin

dbms_refresh.make(

name => 'RG_MVIEW_OWNER',

list => 'mview.employees_mv,mview.departments_mv',

next_date => sysdate,

interval => 'SYSDATE + 1/1440',

implicit_destroy => true,

lax => true);

end;

/

7. initialization refresh

execute dbms_refresh.refresh('RG_MVIEW_OWNER');

At this point, the study of "how to implement distributed replication environment in materialized view" is over, hoping to solve everyone's doubts. Theory and practice can better match to help you learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Tags: Users views distributed environment learning site main site more help practical advanced next articles methods logs theory goals knowledge articles websites Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS OPPO Reno Microsoft MariaDB Redmi