Versions Compared

Key

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

...

If everything went fine, you should see at the top of the console output that MINE and APPLY processes are running and applying changes from PLOG files:

Code Block
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.

...

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;

...

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:

...

Check, that the duplicated row also exists in the target database.

Code Block
languagesql
titleCheck if duplicate row was created
REPOE@TTORCL_trg> select * from repoe.logon where logon_id =1000000 order by customer_id;
  LOGON_ID CUSTOMER_ID LOGON_DATE
---------- ----------- ------------------
   1000000      496840 31-MAR-06
   1000000      496840 31-MAR-06

...

Create conflict

Using the duplicate row we prepared in previous chapter, we can now simulate conflict in replication. 

On source database run following update command.

Code Block
languagesql
titleUpdate causing conflicts
REPOE@TTORCL_SRC> update repoe.logon set logon_id=logon_id*100 where logon_id =1000000;
2 rows updated.
REPOE@TTORCL_SRC> commit;
Commit complete.

 

Check in the console, that we have really created the conflict

On source database run following update command.

Code Block
titleConflict confirm
REPOE.LOGON:                   33%  Mine:3/3             Unrecov:0/0         Applied:1/1         Conflicts:1/1       
Last:23/01/2015 04:05:29/RETRY:Command affected 2 row(s).

 

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

List conflict

...

Listing Conflicts

As we have created a conflict, we have to see what exactly happened.

Connect to dbvrep console and run command list conflict

Code Block
titleList conflict example
dbvrep> list conflict
Information for conflict 32010159940 (current conflict):
Table: REPOE.LOGON at transaction 000a.01f.000001df at SCN 653532
SQL text (with replaced bind values): update "REPOE"."LOGON"
set "LOGON_ID" = 100000000
where (1=1)
and "LOGON_ID" = 1000000
and "CUSTOMER_ID" = 496840
and "LOGON_DATE" = to_date('2006.03.31 04:18:40','yyyy.mm.dd hh24:mi:ss')
Error: Command affected 2 row(s).
Handled as: PAUSE
Conflict repeated 21 times.

Take a note of how was the original query transformed. You can see, that except "LOGON_ID" = 1000000 condition, there were automatically added "CUSTOMER_ID" = 496840 and "LOGON_DATE" = to_date('2006.03.31 04:18:40','yyyy.mm.dd hh24:mi:ss') search conditions. These were added in order to apply be able to uniquely identify the row it needs to change.

 

Create duplicate using more rows DML

...