sp_deletetracertokenhistory (Transact-SQL)
Collapse the table of content
Expand the table of content

sp_deletetracertokenhistory (Transact-SQL)

Applies To: SQL Server 2014, SQL Server 2016 Preview

Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

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.

Topic link icon Transact-SQL Syntax Conventions

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.

Note Note

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.

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.

Tracer token IDs can be determined by executing sp_helptracertokens (Transact-SQL) or by querying the MStracer_tokens (Transact-SQL) system table.

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.

Community Additions

© 2016 Microsoft