Removes tracer token records from the MStracer_tokens (Transact-SQL) and MStracer_history (Transact-SQL) system tables. This stored procedure is executed at the Publisher on the publication database or at the Distributor on the distribution database.
sp_deletetracertokenhistory [ @publication = ] 'publication' [ , [ @tracer_id = ] tracer_id ] [ , [ @cutoff_date = ] cutoff_date ] [ , [ @publisher = ] 'publisher' ] [ , [ @publisher_db = ] 'publisher_db' ]
[ **@publication=** ] 'publication'
Is the name of the publication in which the tracer token was inserted. publication is sysname, with no default.
[ **@tracer_id=** ] tracer_id
Is the ID of the tracer token to delete. tracer_id is int, with a default value of NULL. If null, then all tracer tokens belonging to the publication are deleted.
[ **@cutoff_date=** ] cutoff_date
Specifies a cutoff date such that all tracer tokens inserted into the publication before that date are removed. cutoff_date is datetime, with a default value of NULL.
[ **@publisher=** ] 'publisher'
The name of the Publisher. publisher is sysname, with a default of NULL.
This parameter should only be specified for non-Microsoft SQL Server Publishers.
[ **@publisher_db=** ] 'publisher_db'
The name of the publication database. publisher_db is sysname, with a default value of NULL. This parameter is ignored if the stored procedure is executed at the Publisher.
Return Code Values
0 (success) or 1 (failure)
sp_deletetracertokenhistory is used in transactional replication.
When executing sp_deletetracertokenhistory, you can only specify one of tracer_id or cutoff_date. An error occurs when you specify both parameters.
If you do not execute sp_deletetracertokenhistory to remove tracer token metadata, the information will be removed when the regularly scheduled history cleanup occurs.
Only members of the sysadmin fixed server role, the db_owner fixed database role in the publication database, or db_owner fixed database or replmonitor roles in the distribution database can execute sp_deletetracertokenhistory.