--外网作为SNAPSHOT
--创建外网用户HOLEN
CONN SYSTEM/PASSWORD@ORAWAI
--创建普通用户
CREATE USER "HOLEN" PROFILE "DEFAULT" IDENTIFIED BY "HOLEN";
GRANT "CONNECT" TO "HOLEN";
GRANT "DBA" TO "HOLEN";
GRANT "RESOURCE" TO "HOLEN";
--创建repadmin用户管理快照端复制环境
CREATE USER REPADMIN IDENTIFIED BY REPADMIN;
ALTER USER REPADMIN DEFAULT TABLESPACE USERS;
ALTER USER REPADMIN TEMPORARY TABLESPACE TEMP;
GRANT connect, resource TO REPADMIN;
--授予repadmin用户权限可以管理当前站点中任何主体组
EXECUTE dbms_repcat_admin.grant_admin_any_schema('REPADMIN');
--授予repadmin用户权限可以为任何表创建snapshot logs
GRANT comment any table TO REPADMIN;
GRANT lock any table TO REPADMIN;
--指定repadmin用户为propagator,并授予执行任何procedure的权限
EXECUTE dbms_defer_sys.register_propagator('REPADMIN');
GRANT execute any procedure TO REPADMIN;
--授予repadmin用户可以创建快照
GRANT create any snapshot TO REPADMIN;
GRANT alter any snapshot TO REPADMIN;
--在外网建立与内网的链接
--在外网端需要把ORANEI添加到树
CREATE PUBLIC DATABASE LINK ORANEI CONNECT TO REPADMIN IDENTIFIED BY REPADMIN USING ' ORANEI ';
--在外网建立刷新组 HOLEN_REFRESH
BEGIN
DBMS_REFRESH.MAKE(
name => '"HOLEN"."HOLEN_REFRESH"',
list => '',
next_date => SYSDATE,
interval => '/*1:Mins*/ sysdate + 1/(60*24)',
implicit_destroy => FALSE,
lax => FALSE,
job => 0,
rollback_seg => NULL,
push_deferred_rpc => TRUE,
refresh_after_errors => TRUE,
purge_option => NULL,
parallelism => NULL,
heap_size => NULL);
END;
/
--在外网建立快照组
BEGIN
DBMS_REPCAT.CREATE_SNAPSHOT_REPGROUP(
gname => '"HOLEN_MASTER"',
master => 'ORANEI.US.ORACLE.COM',
propagation_mode => 'ASYNCHRONOUS');
END;
/
--建立快照,快照要在表所属的用户下建立,本例要先用HOLEN用户登陆
CONNECT HOLEN/HOLEN;
--建立快照LAWTABLE
CREATE SNAPSHOT "HOLEN"."LAWTABLE"
REFRESH FAST FOR UPDATE
AS SELECT * FROM "HOLEN"."LAWTABLE"@ ORANEI.US.ORACLE.COM C
/
--将快照加入刷新组
BEGIN
DBMS_REFRESH.ADD(
name => '"HOLEN"."HOLEN_REFRESH"',
list => '"HOLEN"."LAWTABLE"',
lax => TRUE);
END;
/
--将快照加入快照组
BEGIN
DBMS_REPCAT.CREATE_SNAPSHOT_REPOBJECT(
gname => '"HOLEN_MASTER"',
sname => '"HOLEN"',
oname => '"LAWTABLE"',
type => 'SNAPSHOT',
min_communication => FALSE);
END;
/
--建立快照REGISTER
CREATE SNAPSHOT "HOLEN"."REGISTER"
REFRESH FAST FOR UPDATE
AS SELECT * FROM "HOLEN"."REGISTER"@ ORANEI.US.ORACLE.COM C
/
--将快照加入刷新组
BEGIN
DBMS_REFRESH.ADD(
name => '"HOLEN"."HOLEN_REFRESH"',
list => '"HOLEN"."REGISTER"',
lax => TRUE);
END;
/
--将快照加入快照组
BEGIN
DBMS_REPCAT.CREATE_SNAPSHOT_REPOBJECT(
gname => '"HOLEN_MASTER"',
sname => '"HOLEN"',
oname => '"REGISTER"',
type => 'SNAPSHOT',
min_communication => FALSE);
END;
/
--外网端(SNAPSHOT)配置完毕 |