Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Simple DML operations:

Before we start, we should ensure, that replication is setup correctly and is running. Connec to dbvrep console using script start-console.sh on the source machine:

If everything went fine, you should see that MINE and APPLY processes are running and applying changes from PLOG files:

MINE IS running. Currently at plog 32 and SCN 573985 (01/22/2015 23:06:56).
APPLY IS running. Currently at plog 32 and SCN 573979 (01/22/2015 23:06:55)

Lets insert some simple row and check in console, how the replication worked.

We are going to insert a row to the table REPOE.CARD_DETAILS. We will create u unique value of CARD_TYPE column in order to be able to check, whether the row was replicated or not.

Check on target database that the row does not exist on the target:

Code Block
languagesql
titleCheck if CARD_TYPE REPOE_TEST does exist on target database
select count(*) from REPOE.CARD_DETAILS where card_type='REPOE_TEST';
  COUNT(*)
----------
         0

Now insert a row into REPOE.CARD_DETAILS table.

Open any SQL tool, connect as repoe/repoe@TTORCL_SRC to source database and run following query:

Code Block
languagesql
titleSimple insert operation
[oracle@source ~]$ sqlplus repoe/repoe@TTORCL_SRC
REPOE@TTORCL_SRC> insert into REPOE.CARD_DETAILS (card_id, customer_id, card_type, card_number, expiry_date, is_valid, security_code)
2 values (CARD_DETAILS_SEQ.nextval, 1287, 'REPOE_TEST', 9102450385, sysdate, 'Y', 1000 );
1 row created.
REPOE@TTORCL_SRC> commit;
Commit complete.

Now look at the dbvrep console, if the row was successfully replicated;

Code Block
titleOutput of dbvrep console
Progress of replication repoe:MINE->APPLY: total/this execution
------------------------------------------------------------------------------------------------------------------
REPOE.CARD_DETAILS:           100%  Mine:1/1             Unrecov:0/0         Applied:1/1         Conflicts:0/0       
Last:22/01/2015 23:23:54/OK
------------------------------------------------------------------------------------------------------------------

When we see in the console, that the row was sucessfully replicated to the target database, we can check, if it is correctly replicated. Connect to target database as user repoe/repoe and run following command:

Code Block
languagesql
titleCheck if CARD_TYPE REPOE_TEST does exist on target database
select * from REPOE.CARD_DETAILS where card_type='REPOE_TEST';
   CARD_ID CUSTOMER_ID CARD_TYPE                      CARD_NUMBER EXPIRY_DATE        I SECURITY_CODE
---------- ----------- ------------------------------ ----------- ------------------ - -------------
    750005        1287 REPOE_TEST                      9102450385 22-JAN-15          Y          1000

 

Prepare sample schema to replicate

With NODDL option

With DDL option

 

Creation of duplicate rows (potential conflict):

Create duplicate using 1 row DML

insert into repl_dba_tablespaces (select * from repl_dba_tablespaces where tablespace_name='TEMP');

update repl_dba_tablespaces set tablespace_name='TEMP2' where tablespace_name='TEMP';

List conflict

Show, how the problematic query transformed

Create duplicate using more rows DML

How many conflicts were created (1 conflict for 1 row) = >large transactions are separated into single rows

Resolve conflict

 

DML operation with trigger / constraint DML - show cascade constraint problem (smile)

 

 

 

SwingBench can now be started to produce a transaction load and simulate an order-entry system to test the replication. 

Note

Start a new terminal session on the source server, as oracle.

  1. In the $HOME/replicate directory, execute the run_swingbench.bash script to start the charbench utility which is the character based version of SwingBench.
No Format
[oracle@source ~]$ cd $HOME/replicate
[oracle@source replicate]$ ./run_swingbench.bash

The command that will be executed by the script is a very simple one... you can do this on the command line instead of running the script. 

#/bin/bash

# -cs <connect_string>
# -u <schema_user>
# -p <schema_user_password>
# -uc <simulated_user_count>
# -min <min_transaction_think_time_in_milliseconds>
# -max <max_transaction_think_time_in_milliseconds>
# -rt <runtime_hh:mi>
# -a run automatically
# -v display run statistics

/u01/app/oracle/swingbench/bin/charbench -cs //source/XE -u repoe -p repoe -uc 10 -min 5 -max 200 -rt 0:10 -a -v

The output will be similar to the following and will run for 10 minutes. A total number of 10 users will be simulated.

No Format
Author  :	 Dominic Giles
Version :	 2.5.0.932
Results will be written to results.xml.
Time		Users	TPM	TPS
8:39:02 PM	0	0	0
8:39:03 PM	0	0	0
8:39:04 PM	0	0	0
8:39:05 PM	2	0	0
8:39:06 PM	10	10	10
8:39:07 PM	10	23	13
<<output continues>>
Tip

If you want to stop SwingBench before the 10 minutes is up, just hit Ctrl C in the terminal window where it's running to interrupt it.

While the SwingBench is running - keep an eye on your dbvisit console (The dbvisit console should still be running. if not restart the dbvisit console on the source server - cd $HOME/dbvrep_XE  and ./start-console.sh )

Image Removed

Note

It is easy to change the parameters of swingbench to change the load and the time that it runs.

The parameters are:

  • uc. How many users to simulate
  • rt. Run time. How long to run the simulation for
  • min. Transaction think time minimum
  • max. Transaction think time maximum

All command line options are listed here

 

3. Optional. Swingbench is highly configurable. The load on the system can be easily increased. In this example, the number of users is set to 40 and the min and max delay is shortened. As a result the TPS peaks at over 400 transactions per second. 

Note

Your laptop has to be powerful enough to handle this load and a large number of archived redo logs will be generated that may fill up the disk space.

No Format
/u01/app/oracle/swingbench/bin/charbench -cs //source/XE -u repoe -p repoe -uc 40 -min 5 -max 15 -rt 0:10 -a -v
Author  :	 Dominic Giles
Version :	 2.5.0.932
Results will be written to results.xml.
Time		Users	TPM	TPS
20:53:05	[0/40]	0	0
20:53:06	[0/40]	0	0
20:53:07	[0/40]	0	0
20:53:08	[0/40]	0	0
20:53:10	[31/40]	0	0
20:53:13	[40/40]	440	440
20:53:14	[40/40]	478	38
20:53:18	[40/40]	913	435
20:53:19	[40/40]	967	54
20:53:22	[40/40]	1410	443
20:53:23	[40/40]	1446	36
20:53:25	[40/40]	1745	299
20:53:26	[40/40]	1885	140

Right, that should have given the replication something to do. Lets return to the Replication Console and see what's happening.When we successfully installed DBVisit Replicate product on our RepAttack environment, we should test, how the replication works itself. 

This chapter brings some basic examples, that should demonstrate the user how the logical replication works, how are the replicated DMLs transformed, how to use and monitor replicate and how to setup some basic features of replicate such as filtering rows and excluding columns.

Pre-requisites

Please ensure the following pre-requisites have been completed

  1. Download and install Replicate
  2. One-Way Logical Replication Setup

Follow the step by step guide in the Child Pages below. 

Child pages (Children Display)