Skip to main content

Overview

With this method, Artie reads changes from your transaction log backups (.trn files) as they land in a shared location, instead of from the live database.

Requirements

  1. Database recovery model must be set to FULL or BULK_LOGGED
  2. Transaction log backups taken on a schedule, uncompressed, to a location Artie can read
  3. Each replicated table must have a primary key
  4. Each replicated table should have supplemental logging enabled (see below)

Supplemental logging

By default, SQL Server logs only the bytes an UPDATE changed. For those tables, Artie looks the row up in the database when it reads the backup, so the message carries the row as it is at that point rather than as of the update. An update of a row deleted since is then lost. With supplemental logging, SQL Server logs the whole row for every update, and Artie reads updates straight from the backup. Enable it on each table in one of two ways:
To check, is_replicated should be 1 for each table:
Artie lists the replicated tables without supplemental logging when it starts.

Letting the log truncate

Both options mark every transaction on these tables for replication, and SQL Server keeps it in the log until something marks it as distributed. Without the CDC capture job or a Log Reader Agent, log_reuse_wait_desc in sys.databases stays at REPLICATION and the log keeps growing, even with regular log backups. Since Artie reads your log backups, it is safe to mark everything as distributed on a schedule; each log backup still contains every change. Schedule this with SQL Server Agent:
Only run sp_repldone if nothing else reads these transactions: no CDC capture job, and no Log Reader Agent for another publication on the database.
Artie warns when a database’s log has been waiting on REPLICATION for over an hour.

Things to know

  • TRUNCATE TABLE is not allowed on tables tracked by CDC or published for replication.
  • Columns stored off-row (such as large VARCHAR(MAX) values) are not in the log with the rest of the row, so Artie still reads them from the database. If the row has been deleted by then, those columns keep their current values in the destination.