Jul 17, 2011

Making system generated primary key for replication ease

It is highly recommended to have a Primary key or Unique key on each table for GoldenGate replication. There are cases where in relational table, we don't have such a key. The workaround is simple - just add a system generated key as default value.

Example below -

CREATE TABLE LIMITATION  
(  DETERMINATION_ID NUMBER(19,0) NOT NULL,
    LIMITATION VARCHAR2(300 CHAR),
    ID VARCHAR2(32 BYTE) DEFAULT sys_guid(),
     PRIMARY KEY ("ID")

);


The technique was very helpful when we found a couple of tables missing the PK/UK requirements just before a big release!

***