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' ]
Is the name of the publication in which the tracer token was inserted. The data type is sysname. This parameter is required.
[ @tracer_id= ] tracer_id
Is the ID of the tracer token to delete. The data type is int. The default value is null. If null, all tracer tokens belonging to the publication are deleted.
[ @cutoff_date= ] cutoff_date
Tracer tokens inserted into the publication before this date are deleted. The data type is datetime. The default value is null.
[ @publisher= ] 'publisher'
Is the name of the Publisher. The data type is sysname. The default value is null.
This parameter should only be specified for non- MicrosoftSQL Server Publishers or when executing the stored procedure from distributor.
[ @publisher_db= ] 'publisher_db'
Is the name of the publication database. The data type is sysname. The default value is NULL. This parameter is ignored if the stored procedure is executed at the Publisher.
This parameter should be specified when executing the stored procedure from distributor.
Return Code Values
0 (success) or 1 (failure)
sp_deletetracertokenhistory is used in transactional replication.
An error occurs if you specify both parameters tracer_id and cutoff_date.
If you do not execute sp_deletetracertokenhistory to delete tracer token metadata, the information will be deleted when the regularly scheduled history cleanup occurs.
Only the following personnel have the authority to execute sp_deletetracertokenhistory:
- Members of the replmonitor roles, in the distribution database
- Members of the sysadmin fixed server role.
- Members of the db_owner fixed database role, in the publication database.
- The db_owner of the fixed database.