sp_repldone Replication Stored Procedure

Updates the record that identifies the server's last distributed transaction.

Syntax

sp_repldone page, row [, timestamp] [, numtrans] [, time] [, reset]

where

page
Specifies the page for the server's last distributed transaction.
row
Specifies the row for the server's last distributed transaction.
timestamp
Is the timestamp of the server's last distributed transaction.
numtrans
Is the number of transactions distributed.
time
Specifies the number of milliseconds, if provided, needed to distribute the last batch of transactions.
reset
Specifies the reset status. When set to 1, all replicated transactions in the log are marked as distributed. When set to 0, the transaction log is reset to the first replicated transaction and no replicated transactions are marked as distributed.

Valid only when page is 0 and row is 0.

Remarks

This replication stored procedure is used by the logreader process to keep track of which transactions have been distributed.

Caution If you execute this stored procedure manually, you can invalidate the order and consistency of delivered transactions.

With this stored procedure, you can manually tell the server that a transaction has been replicated (sent to the distribution server). It also allows you to change the transaction marked as the next one awaiting replication¾you can move forward or backward in the list of replicated transactions. (All transactions less than or equal to that transaction will be marked as distributed.)

The required parameters page and row can be obtained using the sp_repltrans or sp_replcmds replication stored procedures.

When page is 0, row is 0, and reset is 1, all replicated transactions in the log are marked as distributed. This is useful when there are replicated transactions in the transaction log that are no longer valid (for example, a published table has been dropped) and you want to truncate the log. For example:

sp_repldone 0, 0, NULL, 0, 0, 1

When page is 0, row is 0, and reset is 0, the transaction log is reset to the first replicated transaction and no replicated transactions are marked as distributed. This is useful if you want to scan the transaction log's replicated transactions. For example:

sp_repldone 0, 0, 0, NULL, 0, 0, 0

Or, because these are all default settings:

sp_repldone

Permission

Execute permission defaults to the system administrator.

Table Used

None.

See Also

sp_replcmds sp_replstatus
sp_replflush sp_repltrans