Inside Oracle supplemental logging
Oracle tips by Burleson
Question: What is
supplemental logging, and how does supplemental logging work?
supplemental logging must be enabled for any Change Data Capture
source database. You can see if supplemental logging is
enabled with these queries:
Supplemental logging is also a column in dba_tables.
Supplemental logging places additional column data into the redo log file
whenever an UPDATE operation is performed. At the least, minimal
database-level supplemental logging must be enabled for any Change Data
Capture source database:
SQL> ALTER DATABASE
ADD SUPPLEMENTAL LOG DATA;
Supplemental Logging is enabled, either some selected columns or
all columns are specified for extra logging. They are called a
supplemental log group and consist of nothing but a set
of additional columns that are being logged.
supplemental logging is active on a database, the redo logs
contain other columns from tables to uniquely identify a row. If
the table has a primary key or unique index defined, the only
columns involved in the primary key or unique index will be
registered in the redo logs along with the actual column(s) that
If the table does not have any primary keys or unique index
defined, Oracle will write all scalar columns from the table to
identify the row. This may significantly increase the size of
redo logs and will impact the log apply services on the logical
There are two types of
supplemental log groups that determine when columns in the log
group are logged:
Unconditional Supplemental Log Groups -
The before-images of specified columns are logged any time a row is updated,
regardless of whether the update affected any of the specified columns. This
can be referred to as an ALWAYS log group.
Conditional Supplemental Log Groups -
The before-images of all specified columns are logged only if at least one
of the columns in the log group is updated.
Supplemental Logging can be
enabled at database level or at the table level. When it is
enabled at database level, there are two types, minimal logging
and identification key logging.
Streams supplemental logging places additional column data into
the redo log file whenever an UPDATE operation is performed. At
the least, minimal database-level supplemental logging must be
enabled for any Change Data Capture source database:
ALTER DATABASE ADD
SUPPLEMENTAL LOG DATA;
Why is supplemental logging
needed? When a particular column is updated at the source
database table for a set of rows, the values in the column or
columns are logged by default. When these values are moved to
the destination side, to which rows does Oracle apply them, or
how does Oracle identify the rows to be updated? Supplemental
logging provides the answers to these questions.
Reference books on supplemental
For complete information on
Streams and Data Guard supplemental logging, see these
resources, with working code examples in the code depot: