sp_replcleanup Replication Stored Procedure

Removes transactions from the distribution database tables after they have been successfully distributed to the subscriber's database.

Syntax

sp_replcleanup publisher, subscriber, retention

where

publisher
Is the name of a publication server.
subscriber
Is the name of a subscription server.
retention
Is the number of hours to retain transactions after they have been successfully distributed to the subscription server.

Remarks

The sp_replcleanup stored procedure cleans up jobs for the specified publisher/subscriber pair. It is run on the distribution database and removes entries from these destination database tables: MSjob_commands, MSjobs, MSsubscriber_status, and MSsubscriber_jobs.

Important Each distribution database is automatically cleaned up once a day. There is a default subscriber cleanup task (which has a large overhead) that is scheduled by default to run daily at 1:05 A.M.

Example

This example "cleans up" (removes transactions from) the distribution database tables on the AIREDALE server after they have been successfully distributed to the server WOLFHOUND and retains transactions for at least 8 hours.

sp_replcleanup AIREDALE, WOLFHOUND, 8

Permission

Execute permission defaults to the system administrator.

Tables Used

MSjob_commands, MSjobs, MSsubscriber_status, MSsubscriber_jobs

See Also

sp_replsync sp_replica
sp_distcounters