Using Oracle Advanced Replication Function to implement data synchronization

xiaoxiao2021-04-09  427

/ * From DPS to EMIS, Table DPSUSER.GG_WEB_INFO_M * / / * First, ensure that DPSUSER and corresponding table space DPSData * // * are established in the EMIS database, configure main body * / connection system / manager @ dpsgrant Connect, DBA, Resource to DPSUSER;

/ * Create a replication administrator repadmin * / create user repadmin Identified by repadmin; alter user repadmin; alter user repadmin Temporary TableSpace Temp; Grant Connect, Resource To Repadmin

/ * Grant RepAdmin user rights can manage any main group * / execute dbms_repcat_Admin.grant_admin_Admin_schema ('repadmin') in the current site;

/ * Grant RepAdmin user permissions can create snapshot logs * / grant comment any table to repadmin; Grant Lock any Table to repadmin;

/ * Specify the repadmin user for Propagator and grant permission to perform any procedure * / execute dbms_defer_sys.register_propagator ('repadmin'); grant execute annoudure to repadmin;

/ * Assign rights to the proxy snapshot administration repadmin, list_of_gnames null, meaning that all objects can be managed group * / begindbms_repcat_admin.register_user_repgroup (username => 'repadmin', privilege_type => 'proxy_snapadmin', list_of_gnames => null); end; /

/ * Allocate 'receiver' rights to repadmin * / begindbms_repcat_admin.register_user_repgroup (username => 'repadmin', privilege_type => 'receiver', list_of_gnames => null); end; / grant select any table to repadmin;

/ * Log in as a repadmin * / connection, the main group is established on the DPS, and the main group is named rep_dps and add a table * // * to the main group * // * Establish the main group * / begindbms_repcat.create_master_repgroup gname => 'rep_dps', qualifier =>' ', group_comment =>' '); end; // * table added gg_web_info_m * / begindbms_repcat.create_master_repobject (gname = to the subject group>' rep_dps', type => 'table ', oname =>' gg_web_info_m ', sname =>' dpsuser ', copy_rows => true, use_existing_object => true); end; // * set up corresponding snapshot log * / create snapshot logon dpsuser.gg_web_info_mtablespace systemwith primary keyexcluding new values ;

/ * Copy generation supports * / begindbms_repcat.generate_replication_support (sname => 'dpsuser', oname => 'gg_web_info_m', type => 'table', min_communication => true, generate_80_compatible => false); end; /

/ * Step 2, configure the snapped * / connection system / manager @ EMIS

/ * Modify user rights * / Grant Connect, DBA, Resource to DPSUSER

/ * Create a replication administrator repadmin * / create user repadmin Identified by repadmin; alter user repadmin; alter user repadmin Temporary TableSpace Temp; Grant Connect, Resource To Repadmin

/ * Grant RepAdmin user rights can manage any main group * / execute dbms_repcat_Admin.grant_admin_Admin_schema ('repadmin') in the current site;

/ * Grant RepAdmin user permissions can create snapshot logs * / grant comment any table to repadmin; Grant Lock any Table to repadmin;

/ * Specify the repadmin user for Propagator and grant permission to perform any procedure * / execute dbms_defer_sys.register_propagator ('repadmin'); grant execute annoudure to repadmin;

/ * Grant RepAdmin users can create snapshots * / grant create any snapshot to repadmin; grant alter any snapshot to repadmin

/ * Add to DPS on the EMIS server, you can implement * /

/ * Create a database link with the DPS in EMIS * / create public database link dps connect to repadmin identified by repadmin using 'dps'; / * the establishment of refresh group ref_dps * / begindbms_refresh.make (name => 'dpsuser.ref_dps' in EMIS , list => ', next_date => sysdate, interval =>' / * 1: secs * / sysdate 1 / (60 * 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; /

/ * Create a snapshot in the group of synchronization EMIS synchronous, asynchronous to asynchronous * / begindbms_repcat.create_snapshot_repgroup (gname => 'rep_dps', master => 'dps', propagation_mode => 'asynchronous'); end; /

/ * Establish a snapshot, the snapshot should be established under the user belonging to the table, so you have to use DPSUSER to log in * / connection DPSUSER / DPS @ EMIS

/ * Establish a snapshot of GG_WEB_INFO_M * / create snapshot dps gg_web_info_mbuild immediaterefresh force update 1 / 86400for updateAsslection * from dpsuser.gg_web_info_m@dps;

/ * Add snapshot to refresh group * / begindbms_refresh.add (name => 'DPSUSER.REF_DPS', LIST => 'DPSUSER.GG_WEB_INFO_M', LAX => true); END; /

/ * Add the snapshot snapshot set * / begindbms_repcat.create_snapshot_repobject (gname => 'rep_dps', sname => 'dpsuser', oname => 'gg_web_info_m', type => 'snapshot', min_communication => false); end; /

/ * Step 3, activate the main group * / connect system/Manager@dpsbegindbms_repcat.resume_master_activity (GNAME => 'rep_dps'); END; /

转载请注明原文地址:https://www.9cbs.com/read-133105.html

New Post(0)