这篇文章主要介绍“materialized view怎么实现分布式复制环境”,在日常操作中,相信很多人在materialized view怎么实现分布式复制环境问题上存在疑惑,小编查阅...
这篇文章主要介绍“materialized view怎么实现分布式复制环境”,在日常操作中,相信很多人在materialized view怎么实现分布式复制环境问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”materialized view怎么实现分布式复制环境”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
################################分布式环境下通过materialized view实现表高级复制
1.在主站点建立snapproxy用户
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.在主站点以要复制表的属主创建表的物化视图日志:(这里为hr用户)
conn hr/hr;
create snapshot log on employees with rowid,primary key;
create snapshot log on departments with rowid,primary key;
3.在物化视图站点创建复制表的目标用户:
create user mview identified by mview default tablespace usres;
grant connect,resource,create snashot,create database link to mview;
4.在物化视图站点创建物化视图刷新用户并赋权:
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.在物化视图站点以物化视图用户mview创建到snapproxy用户的dblink及物化视图:
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用户创建刷新组
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.初始化刷新
execute dbms_refresh.refresh('RG_MVIEW_OWNER');
到此,关于“materialized view怎么实现分布式复制环境”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注捷杰建站网站,小编会继续努力为大家带来更多实用的文章!