Preparing for a planned DDL change

In a best case scenario, a DDL change that will affect replication of tables that are being replicated should be known and planned in advance.

In this case you should ensure that the procedure to resume mirroring is executed during a quiescent maintenance period for both source and target systems where no DML changes occur to the CDC Replication in-scope tables (including tables that will not have DDL changes).

DDL changes have to be controlled so that the "log record format" changes do not happen interleaved with DML statements. Meaning that the pattern of operations cannot be a quick succession of DDL DML DDL DML.

All DDL statements must be executed at once with no DML in-between for the duration of the controlled shutdown, the metadata reconfiguration and restarting replication.

When DML occurs in-between DDL statements, a refresh must be performed to get tables back in-sync as there is no other path to recovery.

An example would be when a DDL change was performed, CDC Replication detected the DDL and ended replication. While replication was down, additional DDL and DML operations were performed on the table (for example, insert a row, add a column, insert a row, drop a column). The table definition is now updated within CDC Replication. The table definition would have been updated to the latest structure of the table, and will not account for the additional DML and DDL operations. You would need to perform a refresh to resolve this inconsistency.

Note: The order of the steps for the procedure is important to the success of the execution.