Managing old transaction logs

All transaction logs must be guaranteed available until they are no longer needed by the replication system: at that point, they can be discarded.

The replication system no longer needs the logs when all remote databases have received and successfully applied the messages contained in the log files. Remote databases confirm the successful receipt of messages from the consolidated database, and the confirmation sets a value in the consolidated database SQL Remote tables. The old transaction logs at the consolidated database are no longer needed by SQL Remote when this receipt confirmation has been received from all remote databases.

See The message tracking system.

Using the delete_old_logs option

You can use the delete_old_logs database option at the consolidated database to manage old transaction logs automatically.

The delete_old_logs database option is set by default to Off. If it is set to on, the old transaction logs are deleted automatically by the Message Agent when they are no longer needed. A log is no longer needed when all subscribers have confirmed receiving all changes recorded in that log file.

You can set the delete_old_logs option either for the PUBLIC group or just for the user contained in the Message Agent connection string.

Example

The following statement sets the public delete_old_logs option to delete logs that were created more than 10 days ago:

SET OPTION PUBLIC.delete_old_logs = '10 days';