1. 程式人生 > >OGG對於沒有主鍵表的處理

OGG對於沒有主鍵表的處理

問:想用ogg對生產庫做個報表庫。現在生產庫中還有一堆表沒有主鍵(其中有些表的記錄甚至完全一樣),對這些表上的操作容易導致報表庫REPLICAT abended,請問這在OGG配置中是如何避免的?HANDLECOLLISIONS?

答:
In order to maintain data integrity when replicating transactional data, Oracle GoldenGate will use primary key columns or unique index columns to uniquely identify a row when issuing update or delete statements against the target database. If no primary keys or unique indexes exist on the table being replicated, Oracle GoldenGate will use all columns to uniquely identify a row.

It is perfectly acceptable to use all columns to uniquely identify a row under the following conditions:

  • A logical key column cannot be defined for the table using the KEYCOLS parameter.
  • No duplicate rows exist in the table
  • Table contains a small number of rows, so full table lookups on the target database are minimal
  • Table DML activity is very low, so “all column” table supplemental log groups do not negatively impact the source database redo logs

If the table being replicated does not meet all of the conditions listed above, it is recommended to add a column to the table with a SYS_GUID default value to uniquely identify the row.