FIX: Transaction Log of Snapshot Published Database Cannot Be Truncated (306769)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q306769
BUG #: 354981 (SHILOH_BUGS)

SYMPTOMS

The transaction log of a database, with a snapshot publication, does not truncate if the database is also a Subscriber to a transactional replication publication. The capability to truncate the log should exist because the publication is a snapshot publication. When an attempt to truncate the transaction log occurs, the following error message displays because the publication is a snapshot publication and there is no Log Reader Agent:
The log was not truncated because records at the beginning of the log are pending replication. Ensure the Log Reader Agent is running or use sp_repldone to mark transactions as distributed.

CAUSE

To support loop-back detection in bi-directional replication, the Distribution Agent logs the originator information at the Subscriber for each transaction it commits. This is done by calling a server side stored procedure, sp_replsetoriginator. Inside the sp_replsetoriginator stored procedure, the program checks to see whether the database is published. If the database is not published, then you know it cannot be part of a bi-directional setup, and you do not need to do anything. If the database is published, the program writes a log record with the originator server and database name so that the Log Reader Agent can pick it up and populate replication commands in the distribution database with the information.

While the logic works as expected, there is a problem when bi-directional replication is not used and the Subscriber is also a Publisher for a snapshot publication. In this case, the Subscription database is still marked as published and the Distribution Agent writes these records to the transaction log. This means that the transaction log does not truncate unless you manually invoke a sp_repldone stored procedure from time to time.

RESOLUTION

To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack

Hotfix

NOTE: The following hotfix was created prior to Microsoft SQL Server 2000 Service Pack 2.

The English version of this fix should have the following file attributes or later:
  File name   Platform
  --------------------
  S80433i.exe  Intel
NOTE: Due to file dependencies, the most recent hotfix or feature that contains the preceding files may also contain additional files.

WORKAROUND

To work around this problem either:
  • Run the sp_repldone stored procedure in the database with the snapshot publication (manually or scheduled).

    -or-

  • Use Data Transformation Services (DTS) instead of a snapshot publication to transfer the database to another server.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 2000. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 2.

Modification Type:MajorLast Reviewed:10/9/2003
Keywords:kbbug kbfix kbSQLServ2000preSP2Fix KB306769