We're here to help!

How to Change Name of MINE/APPLY in Dbvisit Replicate

Follow
Description

This articles explains how to re-name MINE and APPLY processes. This Requires Dbvisit Replicate version 2.7.14 or higher

Environment

For this example bi-directional replication was configured for the schema (NODDL) BUTCH. Processes were renamed from default names.

  • Source DB: SDB11@ test210
  • Target DB : TDB11@ test211

Default process names were changed to the following:

| Default Process Name  | Custom Process Name |
| MINE                  | MINE_SRC            |
| APPLY                 | APPLY_SRC           |
| MINE1                 | MINE1_SRC           |
| APPLY1                | APPLY1_SRC          |
Solution
  1. Run Setup Wizard and configure Two-Way Replication which is adding the replication from both SDB11->TDB11 & TDB11->SDB11 instantiating using Data Pump as per the following document:

    https://dbvisit.atlassian.net/wiki/display/ugd7/Data+Instantiation+in+Two-Way+Replication

    Following databases are now configured:
    
    1: Oracle SDB11, SYS/***, SYSTEM/***, dbvrep1/***, USERS/TEMP, dbvrep1/, ASM:No, TZ: +00:00
    2: Oracle TDB11, SYS/***, SYSTEM/***, dbvrep1/***, USERS/TEMP, dbvrep1/, ASM:No, TZ: +00:00
    
    Following replication pairs are now configured:
    1: SDB11 (Oracle) ==> TDB11 (Oracle), DDL: NO, fetcher: No, process suffix: (no suffix), compression: No, encryption: No, network timeout: 60,
    prepare type: single-scn, data load: dp_networklink
    
    2: TDB11 (Oracle) ==> SDB11 (Oracle), DDL: NO, fetcher: No, process suffix: 1, compression: No, encryption: No, network timeout: 60, prepare
    type: single-scn, data load: dp_networklink
    
    Enter number of replication pair to modify it, or "add", or "done": [done]

    Note: I selected to instantiate over the network. You may choose another method.

    Following tables are defined for replication pairs:
    
    1: SDB11 (Oracle) ==> TDB11 (Oracle), DDL: NO, suffix: (no suffix), prepare: single-scn
      BUTCH(tables)
    
    2: TDB11 (Oracle) ==> SDB11 (Oracle), DDL: NO, suffix: 1, prepare: single-scn
      BUTCH(tables)
    
    Following processes are defined:
    
    1: MINE on SDB11
      Host: test210.dbvisit.com, SMTP: No, SNMP: No
    
    2: APPLY on TDB11
      Host: test211.dbvisit.com, SMTP: No, SNMP: No
    
    3: MINE1 on TDB11
      Host: test211.dbvisit.com, SMTP: No, SNMP: No
    
    4: APPLY1 on SDB11
      Host: test210.dbvisit.com, SMTP: No, SNMP: No
    
    Enter number of process to modify it, or "done": [done]
    
    Select database to hold the DDC settings:
    1: SDB11#dbvrep1
    2: TDB11#dbvrep1
    
    Enter database number: [1]
  2. After completing setup wizard, run *-all.sh, this will generate the APPLY.sh file with data pump script as per instructions during setup.
  3. Next edit the APPLY.sh script which imports over the network in this example. Edit APPLY.sh & add CONTENT=METADATA_ONLY to impdp string:
    $ impdp SYSTEM/odb11g@TDB11 table_exists_action=TRUNCATE network_link=SDB11 directory=DATA_PUMP_DIR flashback_scn=105794878 tables=BUTCH.\"MixedCase\",BUTCH.REPTEST1,BUTCH.REPTEST2,BUTCH.REPTEST3,BUTCH.REPTEST4,BUTCH.VIEW,BUTCH.\"space\ table\"   logfile=BUTCH_space_table.log JOB_NAME=DP_TARGET2_0001 CONTENT=METADATA_ONLY
  4. Check target database & you should see the tables created in the schema BUTCH but no rows as desired.
  5. You should compile all schemas replicated as a best practice.
    SQL> EXEC DBMS_UTILITY.COMPILE_SCHEMA( schema => 'BUTCH');
  6. If you have foreign key constraints, these should be disabled before instantiating the target with data as below. For each schema you are replicating on TARGET, on Target database, run:
    SQL> connect butch/<passwd>@TDB11
    SQL>
    SQL> set heading off
    SQL> set verify off
    SQL> set pagesize 1000
    SQL> set linesize 300
    SQL> spool disable_constraints.sql
    SQL> select 'alter table '||table_name||' disable constraint '||constraint_name||';' from user_constraints where constraint_type = 'R' where owner = &owner';
    SQL> spool off

    Then run the dynamic SQL you built to disable FK constraints:

    SQL> @disable_constraints.sql
  7. Now its time to alter the Process Names. Update configuration files located under the config directory:
    $ cd config
    • Edit TARGET2-onetime.ddc & add the following line to the top of the file:
      set _PERL_CARP=1
    • Next replace all the process names:
      | Default Process Name  | Custom Process Name |
      | MINE.                 | MINE_SRC.           |
      | APPLY.                | APPLY_SRC.          |
      | MINE1.                | MINE1_SRC.          |
      | APPLY1.               | APPLY1_SRC.         |

      For Example:

      @/u03/oracle/replicate/TARGET2/TARGET2-MINE_SRC.ddc
      SET APPLY_SRC.MINE_PEER MINE_SRC
      SET APPLY1_SRC.MINE_PEER MINE1_SRC
      SET MINE.APPLY_PEER APPLY_SRC
      SET MINE1_SRC.APPLY_PEER APPLY1_SRC
  8. Next edit TARGET2-setup.dbvrep
    • At the top of the file add the following two lines:
      choose process APPLY_SRC
      choose process MINE_SRC
    • Change other process name & process setting for the SCN further down in the file

      Configuring non-default processes

      old: choose process MINE

      new: choose process MINE1_SRC


      old: choose process APPLY1

      new: choose process APPLY1_SRC


      old: SET APPLY.INSTANTIATE_SCN NOW

      new: SET APPLY_SRC.INSTANTIATE_SCN NOW


      old: SET APPLY1.INSTANTIATE_SCN NOW

      new: SET APPLY1_SRC.INSTANTIATE_SCN NOW

  9. Edit file TARGET2-wizard-ddc.cfg and change directory names in the file for the MINE & APPLY plog/staging files entries:
    MINE_PLOG: '/u03/oracle/replicate/TARGET2/mine1_src/%S.%E'
    MINE_PLOG: '/u03/oracle/replicate/TARGET2/mine_src/%S.%E'
    APPLY_STAGING_DIR: '/u03/oracle/replicate/TARGET2/apply1_src'
    APPLY_STAGING_DIR: '/u03/oracle/replicate/TARGET2/apply_src'
  10. Go back to the directory with all your other files & move the *ddc files to new names:
    $ cd ../
    $ mv TARGET2-MINE.ddc TARGET2-MINE_SRC.ddc
    $ mv TARGET2-APPLY1.ddc TARGET2-APPLY1_SRC.ddc
    $ mv TARGET2-APPLY.ddc TARGET2-APPLY_SRC.ddc
    $ mv TARGET2-MINE1.ddc TARGET2-MINE1_SRC.ddc
  11. Run -all.sh script runs once again to now recreate/repopulate the repository metadata & establish an instantiation point (SCN) for your schema/tables you are replicating. This will create a new APPLY.sh that will be used for instantiation. The APPLY1.sh can be ignored.
    $ ./<replication\_name>-all.sh (or –all.bat script on Windows)
  12. Once the -all.sh/ ()-all.bat on Windows) script completes successfully run APPLY.sh (APPLY.bat) to instantiate target data at the starting point now in metadata (SCN#):
    $ ./APPLY.sh (or APPLY.bat script on Windows)
      Import: Release 11.2.0.4.0 - Production on Wed May 6 08:37:17 2015
      Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
      Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
      With the Partitioning, Oracle Label Security, OLAP, Data Mining,
      Oracle Database Vault and Real Application Testing options
      Starting "SYSTEM"."DP_TARGET2_0001":  SYSTEM/********@TDB11 table_exists_action=TRUNCATE network_link=SDB11 directory=DATA_PUMP_DIR flashback_scn=106212631 tables=BUTCH."MixedCase",BUTCH.REPTEST1,BUTCH.REPTEST2,BUTCH.REPTEST3,BUTCH.REPTEST4,BUTCH.VIEW,BUTCH."space table" logfile=BUTCH_space_table.log JOB_NAME=DP_TARGET2_0001
    
    Estimate in progress using BLOCKS method...
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 448 KB
    Processing object type TABLE_EXPORT/TABLE/TABLE
    Table "BUTCH"."REPTEST1" exists and has been truncated. Data will be loaded but all dependent metadata will be skipped due to table_exists_action of truncate
    Table "BUTCH"."REPTEST2" exists and has been truncated. Data will be loaded but all dependent metadata will be skipped due to table_exists_action of truncate
    Table "BUTCH"."REPTEST3" exists and has been truncated. Data will be loaded but all dependent metadata will be skipped due to table_exists_action of truncate
    Table "BUTCH"."REPTEST4" exists and has been truncated. Data will be loaded but all dependent metadata will be skipped due to table_exists_action of truncate
    Table "BUTCH"."space table" exists and has been truncated. Data will be loaded but all dependent metadata will be skipped due to table_exists_action of truncate
    Table "BUTCH"."MixedCase" exists and has been truncated. Data will be loaded but all dependent metadata will be skipped due to table_exists_action of truncate
    Table "BUTCH"."VIEW" exists and has been truncated. Data will be loaded but all dependent metadata will be skipped due to table_exists_action of truncate
    . . imported "BUTCH"."MixedCase"                             10 rows
    . . imported "BUTCH"."REPTEST1"                              10 rows
    . . imported "BUTCH"."REPTEST2"                              10 rows
    . . imported "BUTCH"."REPTEST3"                              10 rows
    . . imported "BUTCH"."REPTEST4"                              10 rows
    . . imported "BUTCH"."VIEW"                                  10 rows
    . . imported "BUTCH"."space table"                           10 rows
    Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
    Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
    Job "SYSTEM"."DP_TARGET2_0001" successfully completed at Wed May 6 08:16:19 2015 elapsed 0 00:00:17
  13. Re-enable any foreign key constraints on Target for each schema owner tables you are replicating. On Target database:
    SQL> connect butch/<passwd>@TDB11
    SQL>
    SQL> set heading off
    SQL> set verify off
    SQL> set pagesize 1000
    SQL> set linesize 300
    SQL> spool enable_constraints.sql
    SQL> select 'alter table '||table_name||' enable constraint '||constraint_name||';' from user_constraints where constraint_type = 'R' where owner = &owner';
    SQL>

    & run the script:

    SQL> @enable_constraints.sql
  14. Edit start-console.sh & change call to ddc file to your renamed MINE process:
    "/usr/bin/dbvrep" --ddcfile /u03/oracle/replicate/TARGET2/TARGET2-MINE_SRC.ddc $*
  15. Edit your replication startup scripts and rename the startup calls to your new files. For example my run files are TARGET2-run-test210.dbvisit.com.sh & TARGET2-run-test211.dbvisit.com.sh.

    Their contents are now updated:

    $ cat TARGET2-run-test210.dbvisit.com.sh
    DBVREP=/usr/bin/dbvrep
    $DBVREP --daemon --ddcfile /u03/oracle/replicate/TARGET2/TARGET2-APPLY1_SRC.ddc start APPLY1_SRC
    $DBVREP --daemon --ddcfile /u03/oracle/replicate/TARGET2/TARGET2-MINE_SRC.ddc start MINE_SRC
    $ cat TARGET2-run-test211.dbvisit.com.sh
    DBVREP=/usr/bin/dbvrep
    $DBVREP --daemon --ddcfile /u03/oracle/replicate/TARGET2/TARGET2-APPLY_SRC.ddc start APPLY_SRC
    $DBVREP --daemon --ddcfile /u03/oracle/replicate/TARGET2/TARGET2-MINE1_SRC.ddc start MINE1_SRC
  16. Copy the DDC files to the server(s) where the processes will run (target host):
    $ scp /u03/oracle/replicate/TARGET2/TARGET2-APPLY_SRC.ddc test211.dbvisit.com: /u03/oracle/replicate/TARGET2/.
    $ scp /u03/oracle/replicate/TARGET2/TARGET2-MINE1.ddc test211.dbvisit.com: /u03/oracle/replicate/TARGET2/.
    $ scp /u03/oracle/replicate/TARGET2/TARGET2-run-dbvlin211.dbvisit.co.nz.sh
    test211.dbvisit.com: /u03/oracle/replicate/TARGET2/.
  17. For this test I just ran a simple add 10 rows on source SDB11 database & waited until those rows replicated to target (TDB11). Then I proceeded to delete the 10 rows on the target database (TDB11) and verified they were also deleted from source db (SDB11). Below is a Console display after this action:
    Dbvisit Replicate 2.7.14_unreleased.5128(MAX edition) - Evaluation License expires in 30 days
    APPLY1_SRC IS running. Currently at plog 2815 and SCN 106218709 (05/06/2015 08:21:10).
    APPLY_SRC IS running. Currently at plog 1894 and SCN 106219806 (05/06/2015 08:42:25).
    MINE1_SRC IS running. Currently at plog 2815 and SCN 106218883 (05/06/2015 08:21:13).
    MINE_SRC IS running. Currently at plog 1894 and SCN 106219901 (05/06/2015 08:42:32).
    Progress of replication TARGET2:MINE1_SRC->APPLY1_SRC: total/this execution

    
    BUTCH.REPTEST1:               100%  Mine:10/10           Unrecov:0/0        Applied:10/10       Conflicts:0/0       Last:06/05/2015 08:42:26/OK
    BUTCH.REPTEST2:               100%  Mine:10/10           Unrecov:0/0        Applied:10/10       Conflicts:0/0       Last:06/05/2015 08:42:26/OK
    BUTCH.REPTEST3:               100%  Mine:10/10           Unrecov:0/0        Applied:10/10       Conflicts:0/0       Last:06/05/2015 08:42:26/OK
    BUTCH.REPTEST4:               100%  Mine:10/10           Unrecov:0/0        Applied:10/10       Conflicts:0/0       Last:06/05/2015 08:42:26/OK
    BUTCH.space table:            100%  Mine:10/10           Unrecov:0/0        Applied:10/10       Conflicts:0/0       Last:06/05/2015 08:42:26/OK
    BUTCH.MixedCase:              100%  Mine:10/10           Unrecov:0/0        Applied:10/10       Conflicts:0/0       Last:06/05/2015 08:42:26/OK
    BUTCH.VIEW:                   100%  Mine:10/10           Unrecov:0/0        Applied:10/10       Conflicts:0/0       Last:06/05/2015 08:42:26/OK

    7 tables listed.
    Progress of replication TARGET2:MINE_SRC->APPLY_SRC: total/this execution

    
    BUTCH.REPTEST1:               100%  Mine:10/10           Unrecov:0/0        Applied:10/10       Conflicts:0/0       Last:06/05/2015 08:20:50/OK
    BUTCH.REPTEST2:               100%  Mine:10/10           Unrecov:0/0        Applied:10/10       Conflicts:0/0       Last:06/05/2015 08:20:50/OK
    BUTCH.REPTEST3:               100%  Mine:10/10           Unrecov:0/0        Applied:10/10       Conflicts:0/0       Last:06/05/2015 08:20:50/OK
    BUTCH.REPTEST4:               100%  Mine:10/10           Unrecov:0/0        Applied:10/10       Conflicts:0/0       Last:06/05/2015 08:20:50/OK
    BUTCH.space table:            100%  Mine:10/10           Unrecov:0/0        Applied:10/10       Conflicts:0/0       Last:06/05/2015 08:20:50/OK
    BUTCH.MixedCase:              100%  Mine:10/10           Unrecov:0/0        Applied:10/10       Conflicts:0/0       Last:06/05/2015 08:20:50/OK
    BUTCH.VIEW:                   100%  Mine:10/10           Unrecov:0/0        Applied:10/10       Conflicts:0/0       Last:06/05/2015 08:20:50/OK

    7 tables listed.
  18. Delete the old DBVisit MINE and APPLY Services from the control-panel via these commands (Windows):

    On Source Server (Run from CMD-prompt as Administrator):
    sc delete DbvisitReplicateE1REP_MINE
    sc delete DbvisitReplicateE1REP_MINE1
    
    On Target Server (Run from CMD-prompt as Administrator):
    sc delete DbvisitReplicateE1REP_APPLY
    sc delete DbvisitReplicateE1REP_APPLY1
    

Chris Lawless May 08, 2015 02:02

Have more questions? Submit a request

Comments

  • Avatar
    ekalwa

    Hmmm. The process of renaming MINE and/or APPLY services should be MUCH SIMPLER. It should be a simple dbvrep> command on the command-line, after shutting down all MINE and APPLY services. Especially for the Windows platform, this would be MUCH APPRECIATED! Thanks!