Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

This example shows a one-to-many replication where the source is Oracle and it is replication real time to both Oracle and MySQL targets. 

This replication is going to use Swingbench as an Order-Entry simulation system replicating from Oracle to MySQL. Swingbench can be found here: http://www.dominicgiles.com/swingbench.html

This replication will use the Dbvisit LOAD function to create and load all the data into the target database and ensure the data is completely in sync before the replication is started. 

Click here for prerequisite checklist.

Some data types cannot be replicated from Oracle to MySQL. Please see supported data types.

For the Swingbench tables, the following columns will be excluded from the replication because these data types cannot be replicated from Oracle to MySQL:

REPOE.PRODUCT_INFORMATION.WARRANTY_PERIOD   INTERVAL YEAR TO MONTH
REPOE.ORDER_ITEMS.CONDITION                 CONDITION IS A MYSQL KEYWORD
REPOE.ORDERS.ORDER_DATE                     TIMESTAMP(6) WITH LOCAL TIME ZONE

These tables can be replicated to Oracle, but for consistency in this example, they will also be excluded from the Oracle to Oracle replication.

Setup Wizard Example

This example shows an Oracle-to-MySQL one-way replication using the following information.

Server/DatabaseName
Source databaseXE (Oracle)
TNS alias for source databasettorcl_src
Source serversource (Linux)
  
Target database 1Oracle
Target servertarget (Linux)
TNS alias for target databasettorcl_trg
  
Target database 2MySQL
Target servertarget (Linux)
  
Name of the replication (ddcfile)repoe_mysql

Throughout the wizard, defaults are shown in [brackets]. Just press enter to accept them. The replication name in this example is "repoe_mysql".

Setup Swingbench

The command line version of Swingbench is used in this example. Please follow the instruction to download and configure swingbench here.

Ensure Swingbench is configured and has an initial data setup loaded in the source database before continuing to the next step.

Start the setup wizard

First of all start the Dbvisit Reporting command line console:

[oracle@source ~]$ ./dbvrep
Initializing.....done
Dbvisit Replicate 
Copyright (C) Dbvisit Software Limited. All rights reserved.
No DDC file loaded.
Run "setup wizard" to start the configuration wizard or try "help" to see all
commands available.
dbvrep>

Then start the setup wizard and follow the instructions. Most of the defaults can be chosen. Choose Oracle as the first database to be setup:

dbvrep> setup wizard                                                                                                            
This wizard configures Dbvisit Replicate.

The setup wizard creates configuration scripts, which need to be run after the wizard ends. No changes to the databases are
made before that.

The progress is saved every time a list of databases, replications, etc. is shown. It will be re-read if wizard is restarted
and the same DDC name and script path is selected.
Run the wizard now? [yes]                                                                                                       
Accept end-user license agreement? (view/yes/no) [view] yes                                                                     

Before starting the actual configuration, some basic information is needed. The DDC name and script path determines where all
files created by the wizard go (and where to reread them if wizard is rerun) and the license key determines which options are
available for this configuration.
(DDC_NAME) - Please enter a name for this replication (suggestion: use the name of the source database): [] repoe_2             
(LICENSE_KEY) - Please enter your license key: [(trial)]                                                                        
Which Replicate edition do you want to trial (LTD/XTD/MAX): [MAX]                                                               
<tory for location of configuration scripts on this machine: [/u01/app/oracle/repoe_2]                                          

Network configuration files were detected on this system in these locations:
/u01/app/oracle/product/11.2.0/xe/network/admin
(TNS_ADMIN) - Please enter TNS configuration directory for this machine: [/u01/app/oracle/product/11.2.0/xe/network/admin]      
Step 1 - Describe databases
========================================
The first step is to describe databases used in the replication. There are usually two of them (source and target).
Store SYSDBA and DBA passwords? Passwords only required during setup and initialization? (yes/no) [yes]                         
Let's configure the database, describing it's type, connectivity, user names etc.
What type of database is this? (Oracle/MySQL/SQL Server/Oracle AWS RDS/CSV/Hadoop): [Oracle]                                    
Please enter database TNS alias: [] ttorcl_src                                                                                  
Please enter SYSDBA user name: [SYS]                                                                                            
Please enter password for this user: [change_on_install] 
Please enter user with DBA role: [SYSTEM]                                                                                       
Please enter password for this user: [manager] 

Connecting to database ttorcl_src as SYSTEM to query list of tablespaces and to detect ASM (by looking whether any redo logs or
archived logs are stored in ASM).
Enter the Dbvisit Replicate owner (this user will be created by this script): [dbvrep]                                          
Please enter password for this user: [dbvpasswd] 

Permanent tablespaces detected on the database: REPOE_DATA, USERS.
Please enter default permanent tablespace for this user: [REPOE_DATA]                                                           

Temporary tablespaces detected on the database: TEMP.
Please enter default temporary tablespace for this user: [TEMP]                                                                 

Following databases are now configured:
1: Oracle ttorcl_src, SYS/***, SYSTEM/***, dbvrep/***, REPOE_DATA/TEMP, dbvrep/, ASM:NO, TZ: +00:00

Now we are going to add another database. This will be the first of the target database, and it will be Oracle:

Enter the number of the database to modify it, or "add", or "done": [add]                                                       
Let's configure the database, describing it's type, connectivity, user names etc.
What type of database is this? (Oracle/MySQL/SQL Server/Oracle AWS RDS/CSV/Hadoop): [Oracle]                                    
Please enter database TNS alias: [] ttorcl_trg                                                                                  
Please enter SYSDBA user name: [SYS]                                                                                            
Please enter password for this user: [change_on_install] 
Please enter user with DBA role: [SYSTEM]                                                                                       
Please enter password for this user: [manager] 

Connecting to database ttorcl_trg as SYSTEM to query list of tablespaces and to detect ASM (by looking whether any redo logs or
archived logs are stored in ASM).
WARN-1877: This database is not in Archivelog mode; set it before starting Replicate scripts if this is a source database.
Enter the Dbvisit Replicate owner (this user will be created by this script): [dbvrep]                                          
Please enter password for this user: [dbvpasswd] 

Permanent tablespaces detected on the database: REPOE_DATA, USERS.
Please enter default permanent tablespace for this user: [REPOE_DATA]                                                           

Temporary tablespaces detected on the database: TEMP.
Please enter default temporary tablespace for this user: [TEMP]                                                                 

Following databases are now configured:
1: Oracle ttorcl_src, SYS/***, SYSTEM/***, dbvrep/***, REPOE_DATA/TEMP, dbvrep/, ASM:NO, TZ: +00:00
2: Oracle ttorcl_trg, SYS/***, SYSTEM/***, dbvrep/***, REPOE_DATA/TEMP, dbvrep/, ASM:NO, TZ: +00:00

Now we are going to add the third database. This will be one of the target databases and it will be MySQL:

Enter the number of the database to modify it, or "add", or "done": [done] add                                                  
Let's configure the database, describing it's type, connectivity, user names etc.
What type of database is this? (Oracle/MySQL/SQL Server/Oracle AWS RDS/CSV/Hadoop): [Oracle] MySQL                              
Please enter database hostname: [localhost] target                                                                              
Please enter user name of an administrator: [root]                                                                              
Please enter password for this user: [] ****
Enter the user to log into apply database: [root]                                                                               
Please enter password for this user: [password] ****
Enter the database (schema) to use for Dbvisit Replicate internal data (will be created in the script): [dbvrep]                

Now all three databases are configured:

Following databases are now configured:
1: Oracle ttorcl_src, SYS/***, SYSTEM/***, dbvrep/***, REPOE_DATA/TEMP, dbvrep/, ASM:NO, TZ: +00:00
2: Oracle ttorcl_trg, SYS/***, SYSTEM/***, dbvrep/***, REPOE_DATA/TEMP, dbvrep/, ASM:NO, TZ: +00:00
3: MySQL host=target, root/***, root/***, root/***, /, dbvrep/, ASM:n/a, TZ: 
Enter the number of the database to modify it, or "add", or "done": [done] 

We now setup the replication pairs. There will be two pairs. Lets start with the first pair. This is Oracle → Oracle. Here we also specify how we want the data instantiation (initial load) to be done. We are going to use the Dbvisit Replicate LOAD feature to automatically create the tables on the target and load the data prior to replication:

Step 2 - Replication pairs
========================================
The second step is to set source and targets for each replication pair.
Let's configure the replication pair, selecting source and target.
Following databases are described:
1: ttorcl_src (Oracle)  
2: ttorcl_trg (Oracle)  
3: host=target (MySQL) (cannot be source, is not Oracle) 
Select source database: [1]                                                                                                     
Select target database: [2]                                                                                                     
Will DDL replication be enabled? [yes]                                                                                          
Use fetcher to offload the mining to a different server? (yes/no) [no]                                                          
Would you like to encrypt the data across the network (yes or no) [no]                                                          
Would you like to compress the data across the network (yes or no) [no]                                                         
How long do you want to set the network timeouts. Recommended range between 60-300 seconds [60]                                 
Lock and copy the data initially one-by-one or at a single SCN?
one-by-one : Lock tables one by one and capture SCN
single-scn : One SCN for all tables
ddl-only   : Only DDL script for target objects
resetlogs  : Use SCN from last resetlogs operation (standby activation, rman incomplete recovery)
no-lock    : Do not lock tables. Captures previous SCN of oldest active transaction. Requires pre-requisite running of
pre-all.sh script                                                                                                               (one-by-one/single-scn/ddl-only/resetlogs/no-lock) [single-scn] 

What data instantiation script to create?
dp_networklink : Data Pump with network link. No export datafile is created (APPLY.sh)
dp_exp         : Data Pump with export datafile. Creates an export datafile (APPLY.sh)
exp            : Pre-datapump exp/imp with export datafile (APPLY.sh)
ddl_file       : DDL file created (APPLY.sql)
ddl_run        : DDL is automatically executed on target
load           : All replicated data is created and loaded automatically 
none                                                                                                                            (dp_networklink/dp_exp/exp/ddl_file/ddl_run/load/none) [dp_networklink] load
Do you want to (re-)create the tables on target or keep them (they are already created)? (create/keep) [keep] create            

Following replication pairs are now configured:
1: ttorcl_src (Oracle) ==> ttorcl_trg (Oracle), DDL: yes, fetcher: no, process suffix: (no suffix), compression: no,
encryption: no, network timeout: 60, prepare type: single-scn, data load: load_create

Now we will configure the second replication pair (Oracle → MySQL). Here we also specify how we want the data instantiation (initial load) to be done. We are going to use the Dbvisit Replicate LOAD feature to automatically create the tables on the target and load the data prior to replication:

Enter number of replication pair to modify it, or "add", or "done": [done] add                                                  
Let's configure the replication pair, selecting source and target.
Following databases are described:
1: ttorcl_src (Oracle)  
2: ttorcl_trg (Oracle)  
3: host=target (MySQL) (cannot be source, is not Oracle) 
Select source database: [1]                                                                                                     
Select target database: [2] 3                                                                                                   
Will limited DDL replication be enabled? [yes]                                                                                  
Use fetcher to offload the mining to a different server? (yes/no) [no]                                                          
Would you like to encrypt the data across the network (yes or no) [no]                                                          
Would you like to compress the data across the network (yes or no) [no]                                                         
How long do you want to set the network timeouts. Recommended range between 60-300 seconds [60]                                 
Lock and copy the data initially one-by-one or at a single SCN?
one-by-one : Lock tables one by one and capture SCN
single-scn : One SCN for all tables
ddl-only   : Only DDL script for target objects
resetlogs  : Use SCN from last resetlogs operation (standby activation, rman incomplete recovery)
no-lock    : Do not lock tables. Captures previous SCN of oldest active transaction. Requires pre-requisite running of
pre-all.sh script                                                                                                               (one-by-one/single-scn/ddl-only/resetlogs/no-lock) [single-scn] 

What data instantiation script to create?
ddl_file       : DDL file created (APPLY.sql)
ddl_run        : DDL is automatically executed on target
load           : All replicated data is created and loaded automatically 
none                                                                                                                            (ddl_file/ddl_run/load/none) [ddl_file] load
Do you want to (re-)create the tables on target or keep them (they are already created)? (create/keep) [keep] create            

Following replication pairs are now configured:
1: ttorcl_src (Oracle) ==> ttorcl_trg (Oracle), DDL: yes, fetcher: no, process suffix: (no suffix), compression: no,
encryption: no, network timeout: 60, prepare type: single-scn, data load: load_create
2: ttorcl_src (Oracle) ==> host=target (MySQL), DDL: yes, fetcher: no, process suffix: 1, compression: no, encryption: no,
network timeout: 60, prepare type: single-scn, data load: load_create
Enter number of replication pair to modify it, or "add", or "done": [done]                                                      

Now we specify which tables to be replicated for each replication pair. In this example we are going to replicate the whole swingbench schema which is called REPOE:

Step 3 - Replicated tables
========================================
The third step is to choose the schemas and tables to be replicated. If the databases are reachable, the tables are checked for
existence, datatype support, etc., schemas are queried for tables. Note that all messages are merely hints/warnings and may be
ignored if issues are rectified before the scripts are actually executed.

Following tables are defined for replication pairs:
1: ttorcl_src (Oracle) ==> ttorcl_trg (Oracle), DDL: yes, suffix: (no suffix), prepare: single-scn
  No tables defined.
2: ttorcl_src (Oracle) ==> host=target (MySQL), DDL: yes, suffix: 1, prepare: single-scn
  No tables defined.
Enter number of replication pair to modify it, or "done": [1]                                                                   

Please enter list of all individual tables to be replicated. Enter schema name(s) only to replicate all tables in that schema.
Use comma or space to delimit the entries.
Enter the tables and schemas: [] REPOE                                                                                          
Selected schemas: REPOE
Add more tables or schemas? (YES/NO) [NO]                                                                                       

To replicate changes of PL/SQL objects in schema(s), please enter the schemas to be replicated. Note that specifying any entry
will cause additional privileges to be granted to dbvrep. Enter through a comma or space-delimited list.
Enter the list of schemas (PL/SQL): []                                                                                          

You can also specify some advanced options:
1. Exclude some tables from schema-level replication
2. Rename schemas or tables.
3. Specify filtering conditions.
4. (Tables only) Configure Change Data Capture; this does not maintain a copy of the source table, but logs all operations as
separate entries. This is useful for ETL or as an audit trail. This usually requires adding of new columns (timestamps, old/new
values etc.) to the target table.
Specify rename name or filter condition for any of the specified schemas (YES/NO): [no]                                         
(PREPARE_SCHEMA_EXCEPTIONS) - Specify tables to exclude from PREPARE SCHEMA, if any: []                                         

Following tables are defined for replication pairs:
1: ttorcl_src (Oracle) ==> ttorcl_trg (Oracle), DDL: yes, suffix: (no suffix), prepare: single-scn
  REPOE(tables)
2: ttorcl_src (Oracle) ==> host=target (MySQL), DDL: yes, suffix: 1, prepare: single-scn
  No tables defined.

We now specify the tables to be replicated for the second replication pair (Oracle → MySQL). This will be the same as the first pair, but note that it can be different.

 
  • No labels