Truncating the transaction log

Replication Agent provides features for both automatic and manual log truncation.

Replication Agent provides two options for automatic transaction log truncation:

You also have the option to switch off automatic log truncation. By default, automatic log truncation is switched off.

To specify the automatic truncation option you want (including none), use the ra_config command to set the value of the truncation_type configuration parameter.

To truncate the transaction log automatically based on a time interval, use the ra_config command to set the value of the truncation_interval configuration parameter.

At any time, you can truncate the Replication Agent transaction log manually by invoking the pdb_truncate_xlog command at the Replication Agent administration port.

To truncate the transaction log at a specific time, use a scheduler utility to execute the pdb_truncate_xlog command automatically.

Replication Agent for Microsoft SQL Server truncates the primary database log in units of transactions. After Replication Agent for Microsoft SQL Server receives the LTM locator from Replication Server, Replication Agent for Microsoft SQL Server queries the primary database to obtian the transaction ID of the newest transaction that can be truncated. Replication Agent for Microsoft SQL Server then marks as reusable the transaction log space before the newest transaction. Microsoft SQL Server can then write log records into the reusable space.

The sp_repltrans and sp_repldone Microsoft SQL Server commands are issued by Replication Agent to control log truncation within Microsoft SQL Server. These commands require that the Replication Agent user have the db_owner role permission.

NoteMicrosoft SQL Server allows only one session to control log truncation using the sp_repltrans and sp_repldone commands. You should not use these commands while Replication Agent is controlling the log truncation processing.