Tuesday, January 12, 2016

Why OGG Warns me "No unique key is defined" ?


To BottomTo Bottom

In this Document
Symptoms
Cause
Solution



APPLIES TO:

Oracle GoldenGate - Version 10.4.0.84 to 11.1.1.1.9 [Release 10.4.0 to 11.1.1.1]
Information in this document applies to any platform.
**Checked for relevance on 20-06-2014**

SYMPTOMS

When trying to add trandata, GG reports the following warning message

GGSCI> add trandata sh.products

2011-08-03 14:57:20 WARNING OGG-00869 Oracle GoldenGate Command Interpreter for Oracle: No unique key is defined for table PRODUCTS. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.

But I can see there is a primary key 'PRODUCTS_PK' defined for table sh.products.

CAUSE

The PK for the table is either not enabled or not validated.

SOLUTION


1. Check the status of PK

sql> select owner, constraint_name, constraint_type, status, validated from dba_constraints where owner='SH' and constraint_name = 'PRODUCTS_PK';

owner, constraint_name, constraint_type, status, validated
--------------------------------------------------------------
SH PRODUCTS_PK P ENABLED NOT VALIDATED
2.. We can see the PK is "NOT VALIDATED". Use the following sql to make it valid.

SQL> alter table sh.products modify constraint PK_PRODUCTS validate;

Table altered.

3. Once the PK is enabled and validated, try to add trandata again.

GGSCI (sdc-t5240-5-121) 9> add trandata SH.PRODUCTS

Logging of supplemental redo data enabled for table SH.PRODUCTS.

No comments: