views:

98

answers:

2

I have to admit that this just caught me by surprise in a production system. I recently added supplemental logging to a few tables for use with Oracle Change Data Capture. A routine check during an unrelated code build revealed that this apparently created disabled constraints in the database of type "S". I can't seem to find any reference to this in the Oracle docs and the single "S" makes it hard to Google for something relevant.

My questions:

  1. Can anyone thing of a reason that supplemental logging results in an implicit constraint?
  2. Why is it created with a DISABLED state?
  3. Does anyone have experience with the effects of enabling these? We have a standard clean-up process that runs after deployments to fully enable constraints that may have been disabled or enabled novalidate for data migration reasons.
+3  A: 

Constraint type is documented: http://download.oracle.com/docs/cd/E11882_01/server.112/e10820/statviews_1045.htm#REFRN20047

S stands for "Supplemental logging", which is further explained here: http://download.oracle.com/docs/cd/E11882_01/server.112/e10704/strms_glossary.htm#CHDIHHGA and here: http://download.oracle.com/docs/cd/E11882_01/server.112/e10705/prep_rep.htm#STREP107

I don't have any experience with it. This is the result of searching on tahiti.oracle.com.

Regards, Rob.

Rob van Wijk
@Rob: Thanks - didn't think of looking in the dictionary view defs for the constraint types. I'm still interested in why this results in a constraint - I think of a constraint as something that will prevent DML on a table and can't see why supplemental logging would affect a table in that fashion.
dpbradley
+3  A: 

Supplemental logging is necessary to support certain types of asynchronous data capture: AQ Streams for instance, and CDC (both Oracle's and third party's implementations). These mechanisms work by reading the redo logs and applying those changes to some other Oracle database. The point of supplemental logging is to increase the amount of data included in the redo logs, .

There are two ways of enabling supplemental logging. In more recent versions of the database we can set minimal logging at the database level

ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

In additional we can add specify tables and columns in Supplemental Log Groups. The point of this is to include the values for unchanged columns in the change table, as it makes it easier to apply the changes in the target database. Find out more.

Obviously the S type constraint identifies columns in a Supplemental Log Group. I think the reason they are disabled is because they do not enforce a data integrity rule (unlike primary keys or check constraints). If so, I think it would be unwise to enable them, and so you should re-write your automatic clean-up to filter constraints of type S.

APC
Yes, these constraints are part of the supplemental logging architecture, but it seems odd to me that the implementation would involve this construct. I've always considered constraint == data restriction, and this doesn't fit that pattern. Of course, I followed Rob's link to the x_CONSTRAINTS documention and found a few more types have sneaked in while I wasn't looking :-). Time to review all of those utility scripts...
dpbradley
@APC: also, I think I agree with you about not re-enabling them. While it didn't seem to hurt anything in a test system, not understanding the reason for them makes me wary of some edge case with subscription configurations that would fail horribly in production.
dpbradley