Enabling Supplemental Logging in OGG
Enabling Supplemental Logging in OGG
OR
SQL>alter database add supplemental log data (all) columns;
By default, only changed column is logged into transaction logs for any
operations. Normally, this means that primary key columns are not logged
during an update/delete operation. However, Replicat requires the extra
column(primary key/Unique Key columns) in order to apply the
update/delete on the target system. The ADD TRANDATA command in
GGSCI is used to cause Oracle to log extra column in logs for all
transactions on a table.
1. Primary Key
2. Unique Key
3. All columns
Once supplemental logging is enabled, along with column which has been
updated/changed an extra column will be logged into redo logs so that a
row could be uniquely identified. Here it could be either of the one
mentioned as above.
Please note it will increase the size of the redo logs and the trail files as
well. More importantly, if you are applying a change on the target database
using all the columns as the key then the DML ( be it an update or a delete
operation) will not be efficient and will cause your REPLICAT to lag behind.
You might need to sit with the application team to find out what key could
be defined for that table.
Please note the usage of “NOKEY” , usually if you don’t use “NOKEY” and
you try using only “COLS” then you will get an error saying that the
columns you define in “COLS” are already used because by default ADD
TRANDATA adds supplemental logging for all the columns if there is no
primary key defined as stated earlier.
Also, ensure the target database has indexes defined on the columns in
question.
=============================================
============
Supplemental logging must be enabled at database level regardless of the
number of tables to replicate using Oracle GoldenGate.
With supplemental logging enabled on table level (what is required for
OGG, just supplemental logging on database level is not enough),
additionally all unique keys/primary keys will be written to the logs, so not
only the modified values (like in case of an update) - plus few more bytes
for internal information.
Worst case are tables without keys as then all rows will be written. So it
depends on the table design in the source DB, how much additional space
is needed for the logs.
If you have many key values per table, you will need more space as well.
To turn on supplemental logging at the table level, you can execute this
command:
alter table <table_name> add supplemental log group ggs_mytab
(<column_name>, <column_name>) always;
(Note: You must have the ALTER TABLE privilege to execute the above sql
statement.)